;
(function () {
    //工具类名
    TempoMineUtils = {};

    //关系数据库输入节点支持的类型
    TempoMineUtils.inputSupportType = ["oracle", "mysql", "sqlserver", "gp", "db2", "postgresql", "teradata", "gbase8a", "dm", "vertica", "impala", "presto", "oscar708", "kingbase8","trino","hana"];
    //关系数据库输出节点支持的类型
    TempoMineUtils.outputSupportType = ["oracle", "mysql", "sqlserver", "gp", "db2", "postgresql", "teradata", "gbase8a", "dm", "vertica", "oscar708", "kingbase8"];
    //评估的误差图的颜色数组
    TempoMineUtils.ColorArray = ['#000000', '#FABF8F', '#92CDDC', '#B1A0C7', '#C4D79B', '#DA9694', '#95B3D7', '#948A54', '#974706', '#FF0000', '#FF9933', '#00B0F0', '#7030A0', '#538DD5'];
    //InfluxDB输入节点支持的类型
    TempoMineUtils.inputSupportTypeByInfluxdb = ["influxdb", "influxdb2"];

    /**
     * 示例方法
     */
    TempoMineUtils.methodA = function () {
        console.log("this is an example")
    }

    /**
     * 模型输出版本数量上限，默认100
     */
    TempoMineUtils.modelNumUpLimit = 100;

    /**
     * 平台所有类子流程节点id数组
     * bagging ---->bagging分类
     * regressionBagging ---->bagging回归
     * parameterselect ---->自动择参
     * clacrossvalidation ---->分类交叉验证
     * regcrossvalidation ---->回归交叉验证
     * subprocess ---->子流程
     * loopsampledata ---->循环行
     * @type {Array}
     */
    TempoMineUtils.classSubProcessArray = ["bagging", "regressionBagging", "parameterselect", "clacrossvalidation", "regcrossvalidation", "subprocess", "loopsampledata"];

    /**
     * 平台所有输出节点
     * syncoutput ---->同步输出
     * writerdbms ---->关系数据库输出
     * writekafka ---->kafka输出
     * writehive ---->hive输出
     * writehdfs ---->hdfs输出
     * writehbase ---->hbase输出
     * writees ---->es输出
     * writekafkastream ---->kafka输出(流)
     * writefile ---->文件输出
     * writesignalfile ---->信号文件输出
     * writeiotdbsignal ---->iotdb信号输出
     * writeiotdb ---->iotdb输出
     * writefilebatch ---->新文件输出
     * @type {Array}
     */
    TempoMineUtils.outPutNodeArray = ["syncoutput", "writerdbms", "writekafka", "writehive", "writehdfs", "writehbase", "writees", "writekafkastream", "writefile", "writesignalfile", "writeiotdbsignal", "writeiotdb", "writefilebatch"];

    /**
     * 需要执行后才可以获取元信息节点
     * transpose ---->表转置
     * autohandledata ---->自动数据处理
     * featurecross ---->特征交叉
     * signaltodata ---->信号转数据
     * @type {Array}
     */
    TempoMineUtils.metadataNeedExecuteNodeArray = ["transpose", "autohandledata", "featurecross", "signaltodata"];

    /**
     * 需要执行后才可以获取元信息节点(支持全字段输出功能节点)
     * transpose ---->表转置
     * autohandledata ---->自动数据处理
     * featurecross ---->特征交叉
     * @type {Array}
     */
    TempoMineUtils.metadataNeedExecuteNodeArrayNew = ["transpose", "autohandledata", "featurecross"];


    /**
     * 扩展编程节点，需要执行后可以获取元信息节点
     * @type {*[]}
     */
    TempoMineUtils.extendScriptNodes = ["pythonscript"/*,"rscript","matlab","pyspark"*/];

    /**
     * 类子流程
     * subprocess ---->子流程
     * loopsampledata ---->循环行
     * @type {*[]}
     */
    TempoMineUtils.subprocessNodes = ["subprocess", "loopsampledata"];

    /**
     * 非动态数据exa端口的节点
     * psi ---->PSI指标计算
     * randomsplitdataset ---->数据拆分
     * @type {string[]}
     */
    TempoMineUtils.noDynamicExaDataCodeNodes = ["psi", "randomsplitdataset"];

    /**
     * 非动态信号signal端口的节点
     * signalholographic2d ---->全息普
     * signalcrosspower ---->互功率谱
     * signalwienerfiltering ---->维纳滤波
     * signaladaptivefilter ---->自适应滤波
     * orderenvelope ---->阶比包络分析
     * @type {string[]}
     */
    TempoMineUtils.noDynamicSignalCodeNodes = ["signalholographic2d", "signalcrosspower", "signalwienerfiltering", "signaladaptivefilter", "orderenvelope"];

    /**
     * 关系数据库输入节点DB2数据库拖拽sql，需要增加双引号的字段关键字集合
     * @type {string[]}
     */
    TempoMineUtils.readRdbmsDB2Keys = ["CURRENT_DATE"];

    /**
     * 管道流程不支持的模型类型
     * clustering（聚类）| association（关联）| timeseries（时间序列）| comprehensiveevaluation（综合评价）
     * textmining（文本挖掘）| recommendation（推荐）| tensorflow（Tensorflow）
     * @type {string[]}
     */
    TempoMineUtils.plFlowNoSupportModelType = ["clustering", "association", "timeseries", "comprehensiveevaluation", "textmining", "recommendation", "tensorflow"];

    /**
     * 管道流程支持的模型对应的节点id
     * setrole（设置角色）| missvalueprocess（缺失值处理）| normalizeddata（数据标准化）| binning（分箱）| pca（主成分分析）| factor（因子分析）
     * svd（奇异值分解）| linearregression（线性回归）| decisiontreereg（决策树回归）| randomforestreg（随机森林回归）| gbtregression（梯度提升树回归）| bpneuralnetwork（BP神经网络回归）
     * svmregression（SVM回归）| l1l2regularization（L1/2稀疏迭代回归）| isotonicregression（保序回归）| curveregression（曲线回归）| logisticregression（逻辑回归分类）| randomforest（随机森林分类）
     * gbtclassification（梯度提升决策树分类）| c50tree（C45+决策树分类）| decisiontree（CART）| id3（ID3分类）| xgboost（Xgboost分类）| adaboost（Adaboost分类）
     * neuralnetwork（BP神经网络分类）| rbfnetwork（RBF神经网络分类）| bayesnet（贝叶斯网络分类）| nativebayes（朴素贝叶斯）| svm（SVM分类）| knn（KNN）
     * lda（线性判别分类）| l1l2sparseiteration（L1/2稀疏迭代分类）| regressiondnn（DNN回归）| classificationdnn（DNN分类）| lstm（RNN回归）| rnnclassify（RNN分类）
     * @type {string[]}
     */
    TempoMineUtils.plFlowNoSupportNodeTypeId = ["setrole", "missvalueprocess", "normalizeddata", "binning", "pca", "factor",
        "svd", "linearregression", "decisiontreereg", "randomforestreg", "gbtregression", "bpneuralnetwork",
        "svmregression", "l1l2regularization", "isotonicregression", "curveregression", "logisticregression", "randomforest",
        "gbtclassification", "c50tree", "decisiontree", "id3", "xgboost", "adaboost",
        "neuralnetwork", "rbfnetwork", "bayesnet", "nativebayes", "svm", "knn",
        "lda", "l1l2sparseiteration", "regressiondnn", "classificationdnn", "lstm", "rnnclassify",];

    /**
     * 管道流程不支持的集成学习下的所有节点的节点id / 自动学习下的自动择参也不支持
     * regressionBagging（bagging回归）| bagging（bagging分类）| votingreg（voting回归）| votingclassify（voting分类）| parameterselect（自动择参）
     * @type {string[]}
     */
    TempoMineUtils.plFlowNoSupportIntegratedLearningNodeTypeId = ["regressionBagging", "bagging", "votingreg", "votingclassify", "parameterselect"];

    /**
     * 时间序列评估只支持以下时间算法
     * ARIMA、稀疏时间序列、指数平滑、移动平均、向量自回归、灰色预测、回声状态网络、LSTM时序、自动时序、自动择参
     *
     * @type {string[]}
     */
    TempoMineUtils.evaltimeseriesDataSetLimit = ['sarima', 'halfsparsear', 'ewma', 'ma', 'vectorautoreg', 'gray', 'esn', 'lstmseries', 'autotimeseries', 'parameterselect'];

    /**
     * 获取管道流程下支持的模型列表
     * @param datas
     * @returns {*[]}
     */
    TempoMineUtils.getListModelInfoLibraryOfPlFlow = function (datas) {
        var newData = [];
        for (var i = 0; i < datas.length; i++) {
            var modelInfo = JSON.parse(datas[i].modelInfo);
            if (modelInfo) {
                //集成学习下面的算法输出的模型也不支持管道
                if (TempoMineUtils.plFlowNoSupportIntegratedLearningNodeTypeId.indexOf(modelInfo.producerNodeTypeId) > -1) {
                    continue;
                }
                var insightInfo = modelInfo.insightInfo;
                if (insightInfo) {
                    // pmml模型筛选
                    if ("pmml" == insightInfo.producerNodeCategory) {
                        newData.push(datas[i]);
                        continue;
                    }
                    if (TempoMineUtils.plFlowNoSupportModelType.indexOf(insightInfo.producerNodeCategory) == -1
                        && insightInfo.producerNodeTypeId && TempoMineUtils.plFlowNoSupportNodeTypeId.indexOf(insightInfo.producerNodeTypeId) > -1) {
                        newData.push(datas[i]);
                    }
                }
            }
        }
        return newData;
    }

    /**
     * 在流程提交提交和执行之前，将其中python编程节点的输出端口在数据库中的元信息进行清除
     */
    TempoMineUtils.cleanScriptNodeOutPortMetaOfJson = function (json) {
        if (json != null) {
            for (var i = 0; i < json.children.length; i++) {
                var node = json.children[i];
                //  如果该节点是python编程节点，将其数据库中各个D端口的元信息进行删除
                var extendScriptNodes = TempoMineUtils.extendScriptNodes;
                if (node.nodeType && extendScriptNodes.indexOf(node.nodeType) > -1) {
                    // 如果流程中的当前节点不参与计算，则不需要清空数据库中的元信息
                    if (node.parameters.isNeedExcute) {
                        TempoMineMetaUtils.cleanScriptNodeOutPortMeta(node);
                    }
                }
                // 如果是类子流程,内部包含python编程节点
                var subprocessNodes = TempoMineUtils.subprocessNodes;
                if (node.nodeType && subprocessNodes.indexOf(node.nodeType) > -1) {
                    var subprocessChildren = node.flowReadyData.children;
                    for (var j = 0; j < subprocessChildren.length; j++) {
                        var subprocessChild = subprocessChildren[j];
                        if (subprocessChild.nodeType && extendScriptNodes.indexOf(subprocessChild.nodeType) > -1) {
                            // 如果流程中的当前节点不参与计算，则不需要清空数据库中的元信息
                            // 如果子流程不参与计算，其内部的节点自然不参与计算
                            if (node.parameters.isNeedExcute) {
                                TempoMineMetaUtils.cleanScriptNodeOutPortMeta(subprocessChild);
                            }
                        }
                    }
                }
            }
        }
    }


    /**
     * 平台支持全字段输出的节点
     * syncoutput ---->同步输出
     * writerdbms ---->关系数据库输出
     * writekafka ---->kafka输出
     * writehive ---->hive输出
     * writehdfs ---->hdfs输出
     * writefile ---->文件输出
     * writefilebatch ---->新文件输出
     * @type {Array}
     */
    TempoMineUtils.allColsOutPutNodeArray = ["syncoutput", "writerdbms", "writekafka", "writehive", "writehdfs", "writefile", "writefilebatch"];

    /**
     * 获取流程参数常量
     */
    TempoMineUtils.getConstFlowParams = function () {
        return {
            "meirt_param_year": TempoUtils.locale("mine.dangqiannian"),
            "meirt_param_month": TempoUtils.locale("mine.dangqianyue"),
            "meirt_param_week": TempoUtils.locale("mine.dangqianzhou"),
            "meirt_param_day": TempoUtils.locale("mine.dangqianri"),
            "meirt_param_today": TempoUtils.locale("mine.dangqianriqi"),
            "meirt_param_now": TempoUtils.locale("mine.dangqianshijian")
        };
    }

    /**
     * 根据流程参数常量值获取常量名
     */
    TempoMineUtils.getConstFlowParamTextByValue = function (val) {
        var params = TempoMineUtils.getConstFlowParams();
        if (params) {
            for (var name in params) {
                if (name == val) {
                    return params[name];
                }
            }
        }
        return val;
    }

    /**
     * 根据节点的校验信息获取提示信息
     */
    TempoMineUtils.getMessageByCheckResult = function (checkResult) {
        if (checkResult.dataInput === false) {
            //当前节点没有数据输入或数据输入不全
            return TempoUtils.locale("mine.node_dataInput_error");
        }
        if (checkResult.input === false) {
            if (checkResult.msg && checkResult.msg.length > 0) {
                return checkResult.msg;
            }
            //当前节点没有设置自变量
            return TempoUtils.locale("mine.node_input_error");
        }
        if (checkResult.output === false) {
            if (checkResult.msg && checkResult.msg.length > 0) {
                return checkResult.msg;
            }
            //当前节点没有设置因变量
            return TempoUtils.locale("mine.node_output_error");
        }
        if (checkResult.outputType === false) {
            if (checkResult.msg && checkResult.msg.length > 0) {
                return checkResult.msg;
            }
            return TempoUtils.locale("mine.node_output_error");
        }
        if (checkResult.idColumn === false) {
            if (checkResult.msg && checkResult.msg.length > 0) {
                return checkResult.msg;
            }
            return TempoUtils.locale("mine.node_input_idcolumntype_check_error");
        }
        //前置节点配置错误
        return TempoUtils.locale("mine.node_other_error");
    }

    /**
     * 挖掘分析-判断算法节点是否准备好了，适用于回归算法
     *
     * @parammeta var meta = $(this).miningnode('getMetaData');
     * @param data
     *            数据列类别信息
     *
     */
    TempoMineUtils.readyForRegression = function (meta, data) {
        var resultObj = {
            dataInput: false,
            input: true,
            output: false,
            outputType: false,
            isOk: false
        };
        if (!meta || !meta.length || meta.length == 0) {
            return resultObj;
        }
        var predictionNum = 0;
        var labelNum = 0;
        var labelValidNum = 0;
        var metadataValidNum = 0;
        for (var i = 0; i < meta.length; i++) {
            if (!$.isArray(meta[i]) && meta[i].length < 4) {
                continue;
            } else {
                metadataValidNum++;
            }
            var metaData = TempoMineMetaUtils.convertMetaToObj(meta[i]);
            if (metaData.role == window.constant.MINE_DATA_ROLE.PREDICTION) {
                if (!TempoMineMetaUtils.isNumber(metaData.type) && !TempoMineMetaUtils.isChar(metaData.type)
                    && !TempoMineMetaUtils.isVector(metaData.type)) {
                    resultObj.input = false;
                    resultObj.msg = TempoUtils
                        .locale("mine.node_input_regression_error");
                }
                predictionNum++;
            }
            if (metaData.role == window.constant.MINE_DATA_ROLE.LABEL) {
                if (!TempoMineMetaUtils.isNumber(metaData.type)) {
                    resultObj.outputType = false;
                    resultObj.msg = TempoUtils
                        .locale("mine.node_output_regression_error");
                } else {
                    labelValidNum++;
                }
                labelNum++;
            }
        }
        if (predictionNum == 0) {
            resultObj.input = false;
        }
        if (metadataValidNum > 0) {
            resultObj.dataInput = true;
        }
        if (labelNum == 0) {
            resultObj.output = false;
        } else {
            if (labelNum == 1 && labelValidNum == 1) {
                resultObj.output = true;
                resultObj.outputType = true;
            } else {
                resultObj.outputType = false;
                resultObj.msg = TempoUtils
                    .locale("mine.node_output_regression_filedtype_error");
            }
        }
        resultObj.isOk = resultObj.dataInput === true
            && resultObj.input === true && resultObj.output === true
            && resultObj.outputType === true;
        return resultObj;
    }

    /**
     * 挖掘分析-判断算法节点是否准备好了，适用于分类算法
     *
     * @parammeta var meta = $(this).miningnode('getMetaData');
     * @param data
     *            数据列类别信息
     *
     */
    TempoMineUtils.readyForClassification = function (meta, data) {
        var resultObj = {
            dataInput: false,
            input: true,
            output: false,
            outputType: false,
            isOk: false
        };
        if (!meta || !meta.length || meta.length == 0) {
            return resultObj;
        }
        var predictionNum = 0;
        var labelNum = 0;
        var labelValidNum = 0;
        var metadataValidNum = 0;
        for (var i = 0; i < meta.length; i++) {
            if (!$.isArray(meta[i]) && meta[i].length < 4) {
                continue;
            } else {
                metadataValidNum++;
            }
            var metaData = TempoMineMetaUtils.convertMetaToObj(meta[i]);
            if (metaData.role == window.constant.MINE_DATA_ROLE.PREDICTION) {
                if (TempoMineMetaUtils.isDateTime(metaData.type) || TempoMineMetaUtils.isText(metaData.type)) {
                    resultObj.input = false;
                    resultObj.msg = TempoUtils
                        .locale("mine.node_input_classification_error");
                }
                predictionNum++;
            }
            if (metaData.role == window.constant.MINE_DATA_ROLE.LABEL) {
                if (TempoMineMetaUtils.isChar(metaData.type)) {
                    labelValidNum++;
                }
                labelNum++;
            }
        }
        if (predictionNum == 0) {
            resultObj.input = false;
        }
        if (metadataValidNum > 0) {
            resultObj.dataInput = true;
        }
        if (labelNum == 0) {
            resultObj.output = false;
        } else if (labelValidNum == 0) {
            resultObj.outputType = false;
            resultObj.msg = TempoUtils
                .locale("mine.node_output_classification_filedtype_error");
        } else if (labelNum == 1 && labelValidNum == 1) {
            resultObj.output = true;
            resultObj.outputType = true;
        } else if (labelNum > 1 && labelValidNum == 1) {
            resultObj.outputType = false;
            resultObj.msg = TempoUtils
                .locale("mine.node_output_classification_filedtype_error");
        }
        resultObj.isOk = resultObj.dataInput === true
            && resultObj.input === true && resultObj.output === true
            && resultObj.outputType === true;
        return resultObj;
    }


    /**
     * 挖掘分析-判断算法节点是否准备好了，适用于RBF分类算法
     *
     * @parammeta var meta = $(this).miningnode('getMetaData');
     * @param data
     *            数据列类别信息
     *
     */
    TempoMineUtils.readyForRBFClassification = function (meta, data) {
        var resultObj = {
            dataInput: false,
            input: true,
            output: false,
            outputType: false,
            isOk: false
        };
        if (!meta || !meta.length || meta.length == 0) {
            return resultObj;
        }
        var predictionNum = 0;
        var labelNum = 0;
        var labelValidNum = 0;
        var metadataValidNum = 0;
        for (var i = 0; i < meta.length; i++) {
            if (!$.isArray(meta[i]) && meta[i].length < 4) {
                continue;
            } else {
                metadataValidNum++;
            }
            var metaData = TempoMineMetaUtils.convertMetaToObj(meta[i]);
            if (metaData.role == window.constant.MINE_DATA_ROLE.PREDICTION) {
                if (!TempoMineMetaUtils.isNumber(metaData.type)) {
                    resultObj.input = false;
                    resultObj.msg = TempoUtils
                        .locale("mine.node_input_rbf_classification_error");
                }
                predictionNum++;
            }
            if (metaData.role == window.constant.MINE_DATA_ROLE.LABEL) {
                if (TempoMineMetaUtils.isChar(metaData.type)) {
                    labelValidNum++;
                }
                labelNum++;
            }
        }
        if (predictionNum == 0) {
            resultObj.input = false;
        }
        if (metadataValidNum > 0) {
            resultObj.dataInput = true;
        }
        if (labelNum == 0) {
            resultObj.output = false;
        } else if (labelValidNum == 0) {
            resultObj.outputType = false;
            resultObj.msg = TempoUtils
                .locale("mine.node_output_classification_filedtype_error");
        } else if (labelNum == 1 && labelValidNum == 1) {
            resultObj.output = true;
            resultObj.outputType = true;
        }
        resultObj.isOk = resultObj.dataInput === true
            && resultObj.input === true && resultObj.output === true
            && resultObj.outputType === true;
        return resultObj;
    }
    /**
     * 挖掘分析-判断算法是否是被拖入bagging节点的子页面的，适用于（回归，分类）算法
     * @param data
     *            数据列类别信息
     */
    TempoMineUtils.isBaggingSubProcessExport = function (data) {
        if ($('body.mine-insight-report').length > 0 && data.subInsight == 'off') {
            return true;
        }
        return false
    }
    /**
     * 挖掘分析-判断算法节点是否准备好了，适用于（回归，分类）算法
     *
     * @parammeta var meta = $(this).miningnode('getMetaData');
     * @param data
     *            数据列类别信息
     * @param colTypeArr :
        *            输出列的类别数组，示例：[window.constant.COLUMN_TYPE.INT,window.constant.COLUMN_TYPE.DOUBLE]
     * @deprecated
     */

    TempoMineUtils.readyForRegCla = function (meta, data, colTypeArr) {
        var resultObj = {
            dataInput: false,
            input: false,
            output: false,
            outputType: false,
            isOk: false
        };
        if (!meta || !meta.length || meta.length == 0) {
            return resultObj;
        } else {
            resultObj.dataInput = true
        }
        for (var i = 0; i < meta.length; i++) {
            if (!$.isArray(meta[i]) && meta[i].length < 4) {
                continue;
            }
            var metaData = TempoMineMetaUtils.convertMetaToObj(meta[i]);
            if (metaData.role == window.constant.MINE_DATA_ROLE.PREDICTION) {
                resultObj.input = true;
            } else if (metaData.role == window.constant.MINE_DATA_ROLE.LABEL) {
                resultObj.output = true;
                if (colTypeArr.indexOf(metaData.type) != -1) {
                    resultObj.outputType = true;
                }
            }
            if (resultObj.input && resultObj.output) {
                break;
            }
        }
        resultObj.request = colTypeArr;
        resultObj.isOk = resultObj.dataInput === true
            && resultObj.input === true && resultObj.output === true
            && resultObj.outputType === true;
        return resultObj;
    }
    /**
     * 挖掘分析-判断算法节点是否准备好了，适用于（聚类）算法
     *
     * @parammeta var meta = $(this).miningnode('getMetaData');
     * @param data
     *            数据列类别信息
     */
    TempoMineUtils.readyForCluster = function (meta, data) {
        var resultObj = {
            dataInput: false,
            input: true,
            output: true,
            outputType: true,
            isOk: false
        };
        if (!meta || !meta.length || meta.length == 0) {
            return resultObj;
        }
        var predictionNum = 0;
        var metadataValidNum = 0;
        for (var i = 0; i < meta.length; i++) {
            if (!$.isArray(meta[i]) && meta[i].length < 4) {
                continue;
            } else {
                metadataValidNum++;
            }
            var metaData = TempoMineMetaUtils.convertMetaToObj(meta[i]);
            if (metaData.role == window.constant.MINE_DATA_ROLE.PREDICTION) {
                if (TempoMineMetaUtils.isDateTime(metaData.type) || TempoMineMetaUtils.isText(metaData.type)) {
                    resultObj.input = false;
                    resultObj.msg = TempoUtils
                        .locale("mine.node_input_cluster_error");
                }
                predictionNum++;
            }
            if (metaData.role == window.constant.MINE_DATA_ROLE.LABEL) {
                resultObj.output = false;
                resultObj.msg = TempoUtils
                    .locale("mine.node_output_cluster_error");
            }
        }
        if (predictionNum == 0) {
            resultObj.input = false;
        }
        if (metadataValidNum > 0) {
            resultObj.dataInput = true;
        }
        resultObj.isOk = resultObj.dataInput === true
            && resultObj.input === true && resultObj.output === true
            && resultObj.outputType === true;
        return resultObj;
    }
    /**
     * 挖掘分析-判断算法节点是否准备好了，适用于（时间序列）算法
     *
     * 时间学列类算法如下：
     * ARIMA、稀疏时间序列、指数平滑、移动平均、向量自回归、X11、X12、灰色预测、回声状态网络、LSTM时序、自动时序、自动择参
     *
     * @parammeta var meta = $(this).miningnode('getMetaData');
     * @param data
     *            数据列类别信息
     */
    TempoMineUtils.readyForTimeSeries = function (meta, data) {
        var resultObj = {
            dataInput: false,
            input: false,
            output: true,
            outputType: true,
            isOk: false,
            idColumn: true
        };

        if (!meta || !meta.length || meta.length == 0) {
            return resultObj;
        }
        var metadataValidNum = 0;
        var validColNum = 0;
        //保存因变量个数
        var labelNum=0;
        //保存自变量个数
        var colNum = 0;
        //对节点中ID列的个数进行计数
        var idColumnNumber = 0;
        for (var i = 0; i < meta.length; i++) {
            var metaData = TempoMineMetaUtils.convertMetaToObj(meta[i]);
            if (!$.isArray(meta[i]) || meta[i].length < 4) {
                continue;
            } else {
                metadataValidNum++;
            }
            //colNum保存自变量的个数
            if (metaData.role == window.constant.MINE_DATA_ROLE.PREDICTION) {
                if (TempoMineMetaUtils.isNumber(metaData.type)) {
                    validColNum++;
                }
                colNum++;
            } else if (meta[i][3] == window.constant.MINE_DATA_ROLE.LABEL) {
                labelNum++;
            } else if (metaData.role == window.constant.MINE_DATA_ROLE.ID) {
                //记录ID列的个数
                idColumnNumber++;
                //保存ID列的字段类型
                var idColumnType = metaData.type;
                //如果ID列类型非数值型(INT)、数值型(LONG)、日期型(TIMESTAMP)、日期时间(DATETIME)
                if(!TempoMineMetaUtils.isInteger(idColumnType)&&! TempoMineMetaUtils.isTimeType(idColumnType)){
                    //ID列类型存在错误
                    resultObj.idColumn = false;
                    //id列类型
                    var idType = TempoMineMetaUtils.getFieldTypeSelectValueOne()[idColumnType];
                    //当前节点ID列角色不支持
                    resultObj.msg = TempoUtils.locale("mine.node_input_idcolumntype_check_error") + idType;
                }
            }
        }
        //ID列错误判断
        if(idColumnNumber>1){
            //ID列存在错误
            resultObj.idColumn = false;
            //当前节点只能设置一个ID列
            resultObj.msg = TempoUtils.locale("mine.node_input_idline_number_error");
        }
        //因变量错误判断
        if(labelNum>0){
            resultObj.output = false;
            //当前节点不能设置因变量
            resultObj.msg = TempoUtils.locale("mine.node_output_timeseries_error");
        }
        //自变量错误判断
        if (colNum == 0) {
            resultObj.input = false;
            //当前节点没有设置自变量
            resultObj.msg =TempoUtils.locale("mine.node_input_error");
        } else if (colNum > 0 && validColNum == 0) {
            resultObj.input = false;
            //当前节点设置的自变量必须为数值型
            resultObj.msg = TempoUtils.locale("mine.node_input_timeseries_filedtype_error");
        } else if (colNum == 1 && validColNum == 1) {
            resultObj.input = true;
        } else if (colNum > 1) {
            resultObj.input = false;
            //当前节点只能设置一个自变量
            resultObj.msg = TempoUtils.locale("mine.node_input_timeseries_error");
        }
        if (metadataValidNum > 0) {
            resultObj.dataInput = true;
        }
        resultObj.isOk = resultObj.dataInput === true && resultObj.input === true && resultObj.output === true && resultObj.outputType === true&&resultObj.idColumn===true;
        return resultObj;
    }
    /**
     * 挖掘分析-判断算法节点是否准备好了，适用于（关联）算法
     *
     * @parammeta var meta = $(this).miningnode('getMetaData');
     * @param data
     *            数据列类别信息
     */
    TempoMineUtils.readyForAssociation = function (meta, data) {
        var resultObj = {
            dataInput: false,
            input: false,
            output: true,
            outputType: true,
            isOk: false
        };
        if (!meta || !meta.length || meta.length == 0) {
            return resultObj;
        }
        var metadataValidNum = 0;
        var validColNum = 0;
        var colNum = 0;
        for (var i = 0; i < meta.length; i++) {
            var metaData = TempoMineMetaUtils.convertMetaToObj(meta[i]);
            if (!$.isArray(meta[i]) || meta[i].length < 4) {
                continue;
            } else {
                metadataValidNum++;
            }
            if (metaData.role == window.constant.MINE_DATA_ROLE.PREDICTION) {
                if (TempoMineMetaUtils.isChar(metaData.type)) {
                    validColNum++;
                }
                colNum++;
            } else if (meta[i][3] == window.constant.MINE_DATA_ROLE.LABEL) {
                resultObj.output = false;
                resultObj.msg = TempoUtils
                    .locale("mine.node_output_association_error");
            }
        }

        if (colNum == 0) {
            resultObj.input = false;
        } else if (colNum == 1) {
            resultObj.input = false;
            resultObj.msg = TempoUtils.locale("mine.node_input_association_error");
        } else if (colNum > 1 && validColNum == colNum) {
            resultObj.input = true;
        } else {
            resultObj.input = false;
            resultObj.msg = TempoUtils.locale("mine.node_input_association_filedtype_error");
        }

        if (metadataValidNum > 0) {
            resultObj.dataInput = true;
        }
        resultObj.isOk = resultObj.dataInput === true && resultObj.input === true && resultObj.output === true && resultObj.outputType === true;
        return resultObj;
    }

    TempoMineUtils.readyForSequenceassociation = function (meta, data) {
        var resultObj = {
            dataInput: false,
            input: false,
            output: true,
            outputType: true,
            isOk: false
        };
        if (!meta || !meta.length || meta.length == 0) {
            return resultObj;
        }
        var metadataValidNum = 0;
        var validColNum = 0;
        var colNum = 0;
        for (var i = 0; i < meta.length; i++) {
            var metaData = TempoMineMetaUtils.convertMetaToObj(meta[i]);
            if (!$.isArray(meta[i]) || meta[i].length < 4) {
                continue;
            } else {
                metadataValidNum++;
            }
            if (metaData.role == window.constant.MINE_DATA_ROLE.PREDICTION) {
                if (TempoMineMetaUtils.isChar(metaData.type)) {
                    validColNum++;
                }
                colNum++;
            } else if (meta[i][3] == window.constant.MINE_DATA_ROLE.LABEL) {
                resultObj.output = false;
                resultObj.msg = TempoUtils
                    .locale("mine.node_output_association_error");
            }
        }

        if (colNum == 0) {
            resultObj.input = false;
        } else if (colNum == 1) {
            resultObj.input = false;
            resultObj.msg = TempoUtils.locale("mine.node_input_association_error");
        } else if (colNum > 1 && validColNum == colNum) {
            resultObj.input = true;
        } else {
            resultObj.input = false;
            resultObj.msg = TempoUtils.locale("mine.node_input_association_filedtype_error");
        }

        if (metadataValidNum > 0) {
            resultObj.dataInput = true;
        }
        resultObj.isOk = resultObj.dataInput === true && resultObj.input === true && resultObj.output === true && resultObj.outputType === true;
        return resultObj;
    }

    /**
     * 挖掘分析-判断算法节点是否准备好了，适用于推荐算法
     *
     * @parammeta var meta = $(this).miningnode('getMetaData');
     * @param data
     *            数据列类别信息
     *
     */
    TempoMineUtils.readyForRecommendation = function (meta, data) {
        var resultObj = {
            dataInput: false,
            input: true,
            output: false,
            outputType: false,
            isOk: false
        };
        if (!meta || !meta.length || meta.length == 0) {
            return resultObj;
        }
        var predictionNum = 0;
        var idNum = 0;
        var metadataValidNum = 0;
        for (var i = 0; i < meta.length; i++) {
            if (!$.isArray(meta[i]) && meta[i].length < 4) {
                continue;
            } else {
                metadataValidNum++;
            }
            var metaData = TempoMineMetaUtils.convertMetaToObj(meta[i]);
            if (metaData.role == window.constant.MINE_DATA_ROLE.PREDICTION) {
                if (!TempoMineMetaUtils.isNumber(metaData.type)) {
                    resultObj.input = false;
                    resultObj.msg = TempoUtils
                        .locale("mine.node_input_recommendation_error");
                }
                predictionNum++;
            }
            if (metaData.role == window.constant.MINE_DATA_ROLE.ID) {
                idNum++;
            }
        }
        if (predictionNum == 0) {
            resultObj.input = false;
        }
        if (metadataValidNum > 0) {
            resultObj.dataInput = true;
        }
        if (idNum == 0) {
            resultObj.output = false;
            resultObj.msg = TempoUtils
                .locale("mine.node_output_recommendation_filedtype_error");
        } else {
            if (idNum == 1) {
                resultObj.output = true;
                resultObj.outputType = true;
            } else {
                resultObj.outputType = false;
                resultObj.msg = TempoUtils
                    .locale("mine.node_output_recommendation_filedtype_error");
            }
        }
        resultObj.isOk = resultObj.dataInput === true
            && resultObj.input === true && resultObj.output === true
            && resultObj.outputType === true;
        return resultObj;
    }


    /**
     * 比较两个输入列信息是否发生改变
     */
    TempoMineUtils.compareMetaData = function (source, target) {
        var sourceFieldNames = [];
        var targetFieldNames = [];
        if (!source || !target || source.length != target.length) {
            return false;
        }
        var count = 0;
        for (var i = 0; i < source.length; i++) {
            for (var j = 0; j < target.length; j++) {
                if (source[i][0] == target[j][0]
                    && source[i][2] == target[j][2]) {
                    count++;
                }
            }
        }
        if (count == source.length) {
            return true;
        } else {
            return false;
        }
    }

    /**
     * 挖掘分析列表展示默认样式修改 如关系数据库输出列表，需要对缩进等默认样式进行调整
     */
    TempoMineUtils.resizeDefaultJqgridStyle = function (jqgrid, param) {
        // 去掉表格的内容缩进
        jqgrid.find("tr.ui-row-ltr td,td input").css({
            'text-indent': '0px'
        });
        // 编辑状态下，输入框高度设置
        jqgrid.find("tr.ui-row-ltr td input").css({
            'height': "17px",
            "padding-left": "0px"
        });
        if (param == undefined) {
            return;
        }
        // 单元格为下拉的编辑框，设置宽度
        if (param.setSelectWidth) {
            var width = param.selectWidth == undefined ? "56px"
                : param.selectWidth;
            // 宽度设置，居右设置
            jqgrid.find("td .ui-selectmenu-button").css({
                'width': width,
                "padding-right": "0px"
            });
        }
    }


    /***************************************************************************
     * 判断节点的端口类型是否为自定义虚拟端口
     *
     * @param portType
     *            端口类型
     */
    TempoMineUtils.isNotDefaultPort = function (portType) {
        return portType != window.mineConstant.PORT_NODE_DEFAULT;
    }

    /***************************************************************************
     * 判段节点的端口类型是否为数据集端口
     *
     * @param portType
     *            端口类型
     */
    TempoMineUtils.isDataSet = function (portType) {
        return portType == window.mineConstant.PORT_DATASET;
    }


    TempoMineUtils.checkUrlParam = function (param) {
        var regExp = new RegExp(/^[0-9a-zA-z]*$/);
        var params = param.toString()
        if (regExp.test(params)) {
            return params;
        } else {
            return "";
        }
    }

    /***************************************************************************
     * 判段节点的端口类型是否为模型端口
     *
     * @param portType
     *            端口类型
     */
    TempoMineUtils.isGraph = function (portType) {
        return portType == window.mineConstant.PORT_GRAPH;
    }

    /***************************************************************************
     * 判段节点的端口类型是否为模型端口
     *
     * @param portType
     *            端口类型
     */
    TempoMineUtils.isModel = function (portType) {
        return portType == window.mineConstant.PORT_MODEL;
    }

    /***************************************************************************
     * 判段节点的端口类型是否为图形端口
     *
     * @param portType
     *            端口类型
     */
    TempoMineUtils.isGraph = function (portType) {
        return portType == window.mineConstant.PORT_GRAPH;
    }

    /***************************************************************************
     * 判段节点的端口类型是否为流数据端口
     *
     * @param portType
     *            端口类型
     */
    TempoMineUtils.isStream = function (portType) {
        return portType == window.mineConstant.PORT_STREAM;
    }

    /***************************************************************************
     * 判段节点的端口类型是否为流数据端口
     *
     * @param portType
     *            端口类型
     */
    TempoMineUtils.isSignal = function (portType) {
        return portType == window.mineConstant.PORT_SIGNAL;
    }

    /**
     *
     * 获取地址栏参数
     */
    TempoMineUtils.getUrlPara = function (name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substring(1).match(reg);
        if (r != null) {
            return unescape(r[2]);
        } else {
            return null;
        }
    }

    /**
     * 根据数据及列名得到表结构Html meta为数据，格式为[[列1类型，列2类型，列3类型],[值1,值2,值3],[值x,值y,值z]]
     * metaNames为列名，格式为[列1,列2,列3] className:table的class属性 titleName:表格标题 flag判断是否是信号节点
     */
    TempoMineUtils.buildTableByMeta = function (meta, metaNames, className, titleName, flag) {
        var tableStr = "<table class='" + className + "'>";
        // 添加表头信息
        if (metaNames && metaNames.length > 0) {
            tableStr += "<thead>";
            if (titleName && titleName != "") {
                tableStr += "<tr>";
                tableStr += "<th colspan='" + metaNames.length
                    + "' style='text-align:center'>" + titleName + "</th>";
                tableStr += "</tr>";
            }
            tableStr += "<tr>";
            // 先添加表头信息
            for (var i = 0; i < metaNames.length; i++) {
//				tableStr += "<th style='min-width:100px;'>" + metaNames[i] + "</th>";
                var tableName = TempoMineUtils.encodeHTML(metaNames[i]);
                tableStr += "<th>" + tableName + "</th>";
            }
            tableStr += "</tr></thead>";
        }
        // 添加表内容信息
        if (meta && meta.length > 0) {
            tableStr += "<tbody>";
            // 取出列类型，并转换
            var typeFlag = TempoMineUtils.validIsNumberType(meta[0]);
            //根据列的个数来确定需要限制的个数，默认按照10列来计算，每列占20个字符
            var contentLimit = metaNames.length >= 10 ? 22 : (10 - metaNames.length) * 20 + 2;
            // 添加数据
            for (var i = 1; i < meta.length; i++) {
                if (meta[i]) {
                    tableStr += "<tr>";
                    for (var j = 0; j < meta[i].length; j++) {
                        if (meta[i][j] == undefined) {
                            tableStr += "<td></td>";
                            continue;
                        }
                        // 小数位数处理
                        if (typeFlag[j] && flag != window.mineConstant.PORT_SIGNAL) {
                            tableStr += "<td>" + TempoMineUtils.format(meta[i][j], false) + "</td>";
                        } else {
                            var infoStr = meta[i][j];
                            if ($.isPlainObject(meta[i][j]) || $.isArray(meta[i][j])) {
                                infoStr = JSON.stringify(meta[i][j]);
                            }
                            if (infoStr && infoStr.length > contentLimit && flag != window.mineConstant.PORT_SIGNAL) {
                                // 最多显示20个字符<contentLimit>
                                var tip = infoStr;
                                infoStr = TempoMineUtils.encodeHTML(infoStr.substring(0, contentLimit));
                                tip = TempoMineUtils.encodeHTML(tip.substring(0, 200));
                                tableStr += "<td title=\"" + tip + "\">" + infoStr + "...</td>";
                            } else if (infoStr && infoStr.length > contentLimit && flag == window.mineConstant.PORT_SIGNAL && j == 0) {//信号处理 文件名显示通道+文件名称
                                infoStr = TempoMineUtils.encodeHTML(infoStr.substring(infoStr.lastIndexOf("/") + 1));
                                tableStr += "<td>" + infoStr + "</td>";
                            } else if (infoStr && infoStr.length > contentLimit && flag == window.mineConstant.PORT_SIGNAL && j == 3) {//信号处理 信号数据展示前5个数据 悬浮100个
                                var showData = "[";
                                var tip = "["
                                var arrayData = infoStr.substring(1, infoStr.length - 1).split(",")
                                for (var k = 0; k < 5; k++) {
                                    //防止传过来的arrayData[k]不是一个字符型的，indexOf会报错
                                    var cellData = arrayData[k] + "";
                                    if (cellData.indexOf("i") == -1) {
                                        cellData = parseFloat((Number(arrayData[k])).toFixed(4));
                                    }
                                    showData = showData + cellData + ",";
                                }
                                var tipLength = 100;
                                if (arrayData.length < 100) {
                                    tipLength = arrayData.length;
                                }
                                for (var k = 0; k < tipLength; k++) {
                                    //防止传过来的arrayData[k]不是一个字符型的，indexOf会报错
                                    var cellData = arrayData[k] + "";
                                    if (cellData.indexOf("i") == -1) {
                                        cellData = parseFloat((Number(arrayData[k])).toFixed(4));
                                    }
                                    if (k == tipLength - 1) {
                                        tip = tip + cellData + "...]";
                                    } else {
                                        tip = tip + cellData + ",";
                                    }
                                }
                                if (tip.length > 1014) {
                                    var index = tip.indexOf(",", 1000);
                                    tip = tip.substring(0, index) + "...]";
                                }
                                /**
                                 * 42364 洞察页面鼠标悬浮查看处理后的信号数据，显示距离较远
                                 * 查阅了火狐官网，对于鼠标悬浮显示显示问题，官方建议是使用最新版本
                                 * 对于这块得支持不是很全面，针对于-，火狐识别title时，会换行，
                                 * 目前经过测试，位置不跑偏得情况下，最大支持180个字符。
                                 * 针对火狐浏览器，是以下处理方式，谷歌正常显示。
                                 */
                                if (TempoUtils.isFirefox()) {
                                    var index = tip.indexOf(",", 180);
                                    tip = tip.substring(0, index) + "...]";
                                }
                                //ie悬浮问题显示问题处理42182
                                if (TempoUtils.isIE()) {
                                    tip = tip.replace(/(.{60})/g, "$1\n");
                                }
                                tableStr += "<td title=\"" + tip + "\">" + showData + "...]</td>";
                            } else {
                                infoStr = TempoMineUtils.encodeHTML(infoStr);
                                tableStr += "<td>" + infoStr + "</td>";
                            }
                        }
                    }
                    tableStr += "</tr>";
                }
            }
            tableStr += "</tbody>";
        }
        tableStr += "</table>";
        return $(tableStr);
    }

    TempoMineUtils.buildTableByMetaOfVariableselection = function (meta, metaNames, className,
                                                                   titleName, flag) {
        var tableStr = "<table class='" + className + "'>";
        // 添加表头信息
        if (metaNames && metaNames.length > 0) {
            tableStr += "<thead>";
            if (titleName && titleName != "") {
                tableStr += "<tr>";
                tableStr += "<th colspan='" + metaNames.length
                    + "' style='text-align:center'>" + titleName + "</th>";
                tableStr += "</tr>";
            }
            tableStr += "<tr>";
            // 先添加表头信息
            for (var i = 0; i < metaNames.length; i++) {
                var tableName = TempoMineUtils.encodeHTML(metaNames[i]);
                tableStr += "<th>" + tableName + "</th>";
            }
            tableStr += "</tr></thead>";
        }
        // 添加表内容信息
        if (meta && meta.length > 0) {
            tableStr += "<tbody>";
            // 取出列类型，并转换
            var typeFlag = TempoMineUtils.validIsNumberType(meta[0]);
            //根据列的个数来确定需要限制的个数，默认按照10列来计算，每列占20个字符
            var contentLimit = metaNames.length >= 10 ? 22 : (10 - metaNames.length) * 20 + 2;
            // 添加数据
            for (var i = 1; i < meta.length; i++) {
                if (meta[i]) {
                    tableStr += "<tr>";
                    for (var j = 0; j < meta[i].length; j++) {
                        if (meta[i][j] == undefined) {
                            tableStr += "<td></td>";
                            continue;
                        }
                        // 小数位数处理
                        if (typeFlag[j] && flag != window.mineConstant.PORT_SIGNAL) {
                            tableStr += "<td>" + meta[i][j] + "</td>";
                        } else {
                            var infoStr = meta[i][j];
                            if ($.isPlainObject(meta[i][j]) || $.isArray(meta[i][j])) {
                                infoStr = JSON.stringify(meta[i][j]);
                            }
                            if (infoStr && infoStr.length > contentLimit && flag != window.mineConstant.PORT_SIGNAL) {
                                // 最多显示20个字符<contentLimit>
                                var tip = infoStr;
                                infoStr = TempoMineUtils.encodeHTML(infoStr.substring(0, contentLimit));
                                tip = TempoMineUtils.encodeHTML(tip.substring(0, 200));
                                tableStr += "<td title=\"" + tip + "\">" + infoStr + "...</td>";
                            } else if (infoStr && infoStr.length > contentLimit && flag == window.mineConstant.PORT_SIGNAL && j == 0) {//信号处理 文件名显示通道+文件名称
                                infoStr = TempoMineUtils.encodeHTML(infoStr.substring(infoStr.lastIndexOf("/") + 1));
                                tableStr += "<td>" + infoStr + "</td>";
                            } else if (infoStr && infoStr.length > contentLimit && flag == window.mineConstant.PORT_SIGNAL && j == 3) {//信号处理 信号数据展示前5个数据 悬浮100个
                                var showData = "[";
                                var tip = "["
                                var arrayData = infoStr.substring(1, infoStr.length - 1).split(",")
                                for (var k = 0; k < 5; k++) {
                                    //防止传过来的arrayData[k]不是一个字符型的，indexOf会报错
                                    var cellData = arrayData[k] + "";
                                    if (cellData.indexOf("i") == -1) {
                                        cellData = parseFloat((Number(arrayData[k])).toFixed(4));
                                    }
                                    showData = showData + cellData + ",";
                                }
                                var tipLength = 100;
                                if (arrayData.length < 100) {
                                    tipLength = arrayData.length;
                                }
                                for (var k = 0; k < tipLength; k++) {
                                    //防止传过来的arrayData[k]不是一个字符型的，indexOf会报错
                                    var cellData = arrayData[k] + "";
                                    if (cellData.indexOf("i") == -1) {
                                        cellData = parseFloat((Number(arrayData[k])).toFixed(4));
                                    }
                                    if (k == tipLength - 1) {
                                        tip = tip + cellData + "...]";
                                    } else {
                                        tip = tip + cellData + ",";
                                    }
                                }
                                if (tip.length > 1014) {
                                    var index = tip.indexOf(",", 1000);
                                    tip = tip.substring(0, index) + "...]";
                                }
                                /**
                                 * 42364 洞察页面鼠标悬浮查看处理后的信号数据，显示距离较远
                                 * 查阅了火狐官网，对于鼠标悬浮显示显示问题，官方建议是使用最新版本
                                 * 对于这块得支持不是很全面，针对于-，火狐识别title时，会换行，
                                 * 目前经过测试，位置不跑偏得情况下，最大支持180个字符。
                                 * 针对火狐浏览器，是以下处理方式，谷歌正常显示。
                                 */
                                if (TempoUtils.isFirefox()) {
                                    var index = tip.indexOf(",", 180);
                                    tip = tip.substring(0, index) + "...]";
                                }
                                tableStr += "<td title=\"" + tip + "\">" + showData + "...]</td>";
                            } else {
                                infoStr = TempoMineUtils.encodeHTML(infoStr);
                                tableStr += "<td>" + infoStr + "</td>";
                            }
                        }
                    }
                    tableStr += "</tr>";
                }
            }
            tableStr += "</tbody>";
        }
        tableStr += "</table>";
        return $(tableStr);
    }

    TempoMineUtils.encodeHTML = function (str) {
        str = "" + str;
        var s = "";
        if (str.length == 0)
            return "";
        s = str.replace(/&/g, "&amp;");
        s = s.replace(/</g, "&lt;");
        s = s.replace(/>/g, "&gt;");
        //解决52441展示问题
        //s = s.replace(/    /g, "&nbsp;");
        s = s.replace(/\'/g, "'");
        s = s.replace(/\"/g, "&quot;");
        s = s.replace(/\n/g, "<br>");
        s = s.replace(/·/g, "&#183;");
        return s;
    }

    /**
     * 禁止输入的元素校验
     * @param value 输入的值
     * @param xssReg xss校验正则表达式
     */
    TempoMineUtils.disableInputElement = function (value, xssReg) {
        if (!value) {
            return value;
        }
        if (!(xssReg)) {
            xssReg = "<[^<>]+>";
        }
        var regExp = RegExp(xssReg, "g");
        var matcher = value.match(regExp);
        if (matcher && matcher.length > 0) {
            TempoUtils.showTip("【" + value + "】中包含html标签，请检查！");
            return true;
        }
    }

    TempoMineUtils.decodeHTML = function (str) {
        str = "" + str;
        var s = "";
        if (str.length == 0)
            return "";
        s = str.replace(/&amp;/g, "&");
        s = s.replace(/&lt;/g, "<");
        s = s.replace(/&gt;/g, ">");
        s = s.replace(/&nbsp;/g, " ");
        s = s.replace(/'/g, "\'");
        s = s.replace(/&quot;/g, "\"");
        s = s.replace(/<br>/g, "\n");
        s = s.replace(/&#39;/g, "\'");
        s = s.replace(/&#183;/g, "·");
        return s;
    }
    /**
     * 根据数据及列名得到表结构Html meta为数据，格式为[[列1类型，列2类型，列3类型],[值1,值2,值3],[值x,值y,值z]]
     * metaNames为列名，格式为[列1,列2,列3] className:table的class属性 widthArr:表格单元格的宽度
     */
    TempoMineUtils.buildCustomWithTableByMeta = function (meta, metaNames, className,
                                                          widthArr) {
        var tableStr = "<table class='" + className + "'>";
        // 添加表头信息
        if (metaNames && metaNames.length > 0) {
            tableStr += "<thead>";
            tableStr += "<tr>";
            // 先添加表头信息
            for (var i = 0; i < metaNames.length; i++) {
                tableStr += "<th style='width:" + widthArr[i] + "'>" + metaNames[i] + "</th>";
            }
            tableStr += "</tr></thead>";
        }
        // 添加表内容信息
        if (meta && meta.length > 0) {
            tableStr += "<tbody>";
            // 添加数据
            for (var i = 0; i < meta.length; i++) {
                if (meta[i]) {
                    tableStr += "<tr>";
                    for (var j = 0; j < meta[i].length; j++) {
                        tableStr += "<td>" + meta[i][j] + "</td>";
                    }
                    tableStr += "</tr>";
                }
            }
            tableStr += "</tbody>";
        }
        tableStr += "</table>";
        return $(tableStr);
    }

    /**
     * 判断scala类型是否为数值型，且是小数，用于处理小数位数
     * types:每个列的类型[DoubleType,FloatType,IntegerType,TimestampType,DecimalType,LongType,...]
     * 返回[true,false,true,...]
     */
    TempoMineUtils.validIsNumberType = function (types) {
        //科学计数法
        var typeFlag = [];
        for (var i = 0; i < types.length; i++) {
            var typeItem = types[i].toLowerCase();
            if (typeItem == "doubletype" || typeItem == "floattype" || typeItem == "decimaltype" || typeItem.startsWith("decimaltype")) {
                typeFlag.push(true);
            } else {
                typeFlag.push(false);
            }
        }
        return typeFlag;
    }

    /**
     * jqgrid编辑行样式完善及下拉选择框样式渲染修改，在数据添加完成或者添加一行数据后调用
     * rowid：行号，若行号为空，则表格所有内容的样式，否则只设置rowid这一行的样式 parentPanel：父容器 grid：表格
     * selections：每一行需要渲染的下拉框数组，格式如下： [{ name:"字段名" width:"100px"
     * change:{change:function(event,ui){ parentPanel.find("#"+this.id +
     * "-button").attr("title",parentPanel.find("#"+this.id+"
     * option:selected").text()); }} }]
     */
    TempoMineUtils.completeEditGridStyle = function (rowid, parentPanel, grid,
                                                     selections) {

    }

    /**
     * 将传入的列类型转换为STRING(字符型)、NUMBER(数值型)、DATE(日期型) originType:为原始类型
     */
    TempoMineUtils.getCommonType = function (originType) {
        if (!originType) {
            return originType;
        }
        originType = originType.trim().toUpperCase();
        var commonType = originType;
        if (originType == "DATE") {
            commonType = "TIMESTAMP";
        } else if (originType == "INT" || originType == "DOUBLE"
            || originType == "FLOAT") {
            commonType = "NUMBER";
        }
        return commonType;
    }
    /**
     * 构建hashMap对象
     */
    TempoMineUtils.hashMap = function () {
        return {
            put: function (mKey, value) {
                this[mKey] = value
            },
            get: function (mKey) {
                return this[mKey]
            },
            contains: function (mKey) {
                return this.get(mKey) == null ? false : true
            },
            remove: function (mKey) {
                delete this[mKey]
            }
        }
    }

    /**
     * 生成1-1.0E8随机数字
     */
    TempoMineUtils.generateSixRandomDigtal = function () {
        var randomDigtal = "";
        for (var i = 0; i < 6; i++) {
            randomDigtal += Math.floor(Math.random() * 10);
        }
        return parseInt(randomDigtal);
    }

    /**
     * 生成1-1.0E8随机数字
     */
    TempoMineUtils.generateRandomDigtal = function () {
        var randomDigtal = "";
        for (var i = 0; i < 8; i++) {
            randomDigtal += Math.floor(Math.random() * 10);
        }
        return parseInt(randomDigtal);
    }

    /**
     * 使算法节点配置界面上的参数不能编辑
     * @param parentElement 算法节点配置界面的顶层div对象
     * @param formEditable  算法节点配置界面是否可编辑
     */
    TempoMineUtils.disabledPropertyParam = function (parentElement, formEditable) {
        if (formEditable === false) {
            parentElement.find("input").attr("disabled", true);
            //parentElement.find("button").attr("disabled",true);
            parentElement.find("textarea").attr("readonly", "readonly");
            parentElement.find("button").each(function () {
                if ($.data(this, 'tempo-button')) {
                    $(this).button("option", "disabled", true);
                } else {
                    $(this).attr("disabled", true);
                }
            });
            parentElement.find(".tempo-datagrid-button").off('click');
            parentElement.find(".tempo-datagrid-button").css("opacity", "0.3");
            parentElement.find(".tempo-datagrid-button").css("cursor", "default");
            parentElement.find("select").each(function () {
                if ($.data(this, 'tempo-selectmenu')) {
                    $(this).selectmenu("option", "disabled", true);
                } else {
                    $(this).attr("disabled", true);
                }
            });
            parentElement.find('tbody>tr').unbind('click').bind('click', function (e) {
                if (e) {
                    e.stopPropagation();
                }
            });
        }
    }

    /**
     * 隐藏算法节点配置界面上的说明
     * @param parentElement 算法节点配置界面的顶层div对象
     * @param algNodeIsHidden  算法节点配置界面上的说明是否隐藏
     */
    TempoMineUtils.hiddenAlgNodeExplain = function (parentElement, algNodeIsHidden) {
        if (algNodeIsHidden === true) {
            parentElement.find(".tempo-mine-alg-explain").hide();
            parentElement.find(".tempo-mine-alg-button").hide();
        }
    }
    /**
     * 输出流程json到控制台
     * */
    TempoMineUtils.logFlowJson = function () {
        var analyseStatus = Eventbus.triggerHandler("getAnalyseStatus")[0];
        var id = analyseStatus.getMainId();
        var page = analyseStatus.getFlowPanel(id);
        var board = page.panel.flowpanel('getBoard');
        var json = board.miningboard("getCommonFlowData");
        console.log(JSON.stringify(json));
    }
    /**
     * 创建挖掘端点节点洞察表格
     * @param metadata
     *            元信息
     * @param className
     *            表格样式
     */
    TempoMineUtils.createMinePointInsightTable = function (metadata, className) {
        var tableInfo = '<div class="tempo-miningnode-endpoint-tooltip-div" style="max-width:400px;max-height:400px;overflow-y:auto"><table class="' + className + '"><thead><tr><th>' + TempoUtils.locale('mine.filedname') + '</th><th>' + TempoUtils.locale('mine.filedtype') + '</th><th>' + TempoUtils.locale('mine.filedrole') + '</th></tr></thead>';
        if (metadata && metadata.length > 0) {
            for (var i = 0; i < metadata.length; i++) {
                var rowContext = [];
                var metadataItem = metadata[i];
                var metaRole = TempoUtils.locale('mine.roleregular');
                if (metadataItem[3] == window.mineConstant.ROLE_TYPE_REGULAR) {
                    metaRole = TempoUtils.locale('mine.roleregular');
                } else if (metadataItem[3] == window.mineConstant.ROLE_TYPE_PREDICTION) {
                    metaRole = TempoUtils.locale('mine.roleprediction');
                } else if (metadataItem[3] == window.mineConstant.ROLE_TYPE_LABEL) {
                    metaRole = TempoUtils.locale('mine.rolelabel');
                } else if (metadataItem[3] == window.mineConstant.ROLE_TYPE_ID) {
                    metaRole = TempoUtils.locale('mine.roleid');
                } else if (metadataItem[3] == window.mineConstant.ROLE_TYPE_WORDSEG) {
                    metaRole = TempoUtils.locale('mine.wordseg');
                } else if (metadataItem[3] == window.mineConstant.ROLE_TYPE_TEXT) {
                    metaRole = TempoUtils.locale('mine.textmining_textcolumn');
                } else if (metadataItem[3] == window.mineConstant.ROLE_TYPE_BINING) {
                    metaRole = TempoUtils.locale('mine.bining');
                } else if (metadataItem[3] == window.mineConstant.ROLE_TYPE_WOE) {
                    metaRole = "woe";
                }
                var fTypeSelV = TempoMineMetaUtils.getFieldTypeSelectValueOne();
                tableInfo += '<tr><td>' + metadataItem[0] + '</td><td>' + fTypeSelV[metadataItem[2]] + '</th><td>' + metaRole + '</td></tr>';
            }
            tableInfo += '</table></div>';
            return tableInfo;
        }
        return "";
    }

    /**
     * 创建挖掘信号处理端点节点洞察表格
     * @param metadata
     *            元信息
     * @param className
     *            表格样式
     */
    TempoMineUtils.createSighnalMinePointInsightTable = function (metadata, className) {
        var tableInfo = '<div class="tempo-miningnode-endpoint-tooltip-div" style="max-width:400px;max-height:400px;overflow-y:auto"><table class="' + className + '"><thead><tr><th>' + TempoUtils.locale('mine.signalfilename') + '</th><th>' + TempoUtils.locale('mine.signalchannelnum') + '</th><th>' + TempoUtils.locale('mine.signalframerate') + '</th><th>' + TempoUtils.locale('mine.signaldatasize') + '</th></tr></thead>';
        if (metadata && metadata.length > 0) {
            for (var i = 0; i < metadata.length; i++) {
                var metadataItem = metadata[i];
                tableInfo += '<tr><td>' + metadataItem[0] + '</td><td>' + metadataItem[1] + '</td><td>' + metadataItem[2] + '</td><td>' + metadataItem[3] + '</td></tr>';
            }
            tableInfo += '</table></div>';
            return tableInfo;
        }
        return "";
    }
    /**
     * 创建挖掘青岛四方信号处理端点节点元信息表格
     * @param metadata
     *            元信息
     * @param className
     *            表格样式
     */
    TempoMineUtils.createQingdaoSighnalMinePointInsightTable = function (metadata, className) {
        var tableInfo = '<div class="tempo-miningnode-endpoint-tooltip-div" style="max-width:400px;max-height:400px;overflow-y:auto;overflow-x: auto"><table class="' + className + '"><thead><tr><th>' + TempoUtils.locale('mine.signalfilename') + '</th><th>起始时间</th><th>' + TempoUtils.locale('mine.signalchannelnum') + '</th><th>' + TempoUtils.locale('mine.signaldatasize') + '</th></tr></thead>';
        if (metadata && metadata.length > 0) {
            for (var i = 0; i < metadata.length; i++) {
                var metadataItem = metadata[i];
                tableInfo += '<tr><td>' + metadataItem[0] + '</td><td>' + metadataItem[1] + '</td><td>' + metadataItem[2] + '</td><td>' + metadataItem[3] + '</td></tr>';
            }
            tableInfo += '</table></div>';
            return tableInfo;
        }
        return "";
    }

    /**
     * 获取jqgrid数据，带编辑框
     * @param grid
     *            表格
     * @param colNames
     *            编辑列的列名称，数组类型,如[{name:字段1,type:下拉框},{name:字段2,type:输入框}]
     */
    TempoMineUtils.getJqgrdData = function (grid, colNames) {
        if (!grid || !colNames) {
            return [];
        }
        var rowids = grid.jqGrid("getDataIDs");
        var rowDatas = grid.jqGrid('getRowData');
        if (rowids.length != rowDatas.length) {
            return rowDatas;
        }
        for (var i = 0; i < rowids.length; i++) {
            for (var j = 0; j < colNames.length; j++) {
                // 若没有设置type属性，则直接通过val的方式获取值
                if (!colNames[j].type) {
                    rowDatas[i][colNames[j].name] = grid.find("#" + rowids[i] + "_" + colNames[j].name).val();
                } else {
                    if (colNames[j].type && colNames[j].valMethod) {
                        rowDatas[i][colNames[j].name] = grid.find("#" + rowids[i] + "_" + colNames[j].name)[colNames[j].type](colNames[j].valMethod);
                    }
                }
            }
        }
        return rowDatas;
    }
    /**
     * 获取针对元信息的jqGrid数据，带编辑框 //本方法可以得到没有编辑的表格数据，一直打开编辑的表格数据，若只是部分数据编辑中，则不可用本方法。
     * @param grid
     *            表格
     * @param colNames
     *            编辑列的列名称，数组类型,如[{name:字段1,type:下拉框},{name:字段2,type:输入框}]
     */
    TempoMineUtils.getMetaJqgrdData = function (grid, colNames) {
        if (!grid || !colNames) {
            return [];
        }

        var rowids = grid.jqGrid("getDataIDs");
        var rowDatas = grid.jqGrid('getRowData');
        if (rowids.length != rowDatas.length) {
            return rowDatas;
        }
        var savedMeta = [];
        for (var i = 0; i < rowids.length; i++) {
            var cMItem = TempoMineMetaUtils.convertObjToMeta(rowDatas[i]);
            for (var j = 0; j < colNames.length; j++) {
                // 若没有设置type属性，则直接通过val的方式获取值
                if (!colNames[j].type) {
                    rowDatas[i][colNames[j].name] = grid.find("#" + rowids[i] + "_" + colNames[j].name).val();
                }
                cMItem.push(rowDatas[i][colNames[j].name]);
            }
            savedMeta.push(cMItem);
        }
        return {"savedMeta": savedMeta, "rowDatas": rowDatas};
    }

    /**
     * 对数据进行格式化
     * transToScientific:是否转换为科学计数法，默认为true
     */
    TempoMineUtils.format = function (value, transToScientific) {
        if (!value || !$.isNumeric(value)) {
            return value;
        }
        var strValue = value + "";
        if (strValue.startsWith("00") || (strValue.length >= 2 && (strValue.startsWith("0") && !strValue.startsWith("0.")))) {
            return value;
        }
        //超过这个值会出现精度丢失的问题，这块直接按原值返回，这个值不能是科学计数法的值
        if((Number(value) >= 999999999999999.9 || Number(value) <= -999999999999999.9 )&& value.toString().split(/[eE]/).length == 1){
            if(value.toString().split(".").length == 2){
                var str = value.toString().split(".")
                var start = str[0]
                var end = str[1]
                if(end.length > 4){
                    var endNumber = end[4];
                    //小数点后位数大于4，则判断第5位是否大于4，大于则进行4舍5入
                    if(Number(endNumber) > 4 && "9999" != end.substring(0,4)){
                        var endd = Number("0."+end.substring(0,4))+0.0001;
                        if(endd.toString().length > 6){
                            endd = endd.toString().substring(0,6);
                        }
                        return start+"."+endd;
                    }else if(Number(endNumber) > 4 && "9999" == end.substring(0,4)){
                        return (BigInt(start)+BigInt(1)).toString()
                    }
                    return start+"."+end.substring(0,4)
                }
            }
            return value;
        }
        //科学计数法幂次超过6之后Number函数无法转成正确的数值类型
        value = Number(value);
        var bit = 4;
        var s = value.toString();
        var es = s.split(/[eE]/);
        if (es.length == 2 && es[1] < 0) {
            //科学计数法为负幂次（由于保留四位有效数字之后成为0.0000，直接展示0.0000）
            return "0.0000";
        } else if (es.length == 2 && es[1] > 0) {
            //科学计数法为正幂次
            return value;
        }
        // 取出"-"号
        var preFix = "";
        if (s.startsWith("-")) {
            preFix = "-";
            s = s.substring(1, s.length);
            value = s;
        }
        var p = s.indexOf('.');
        //是不是带有小数位
        if (p > -1) {
            var f = Number(s.split('.')[0]); // 整数部分，大于等于0
            var b = Number(s.split('.')[1]); // 小数部分，大于0
            if (f > 0) {
                b = Math.round(b / Math.pow(10, (s.length - p - 1) - bit));
                if (Math.pow(10, bit) == b) {
                    f += 1;
                    b = 0;
                }
            } else {
                //取小数部分的前bit位，是否为0
                var tmp = Math.floor(b / Math.pow(10, (s.length - p - 1) - bit));
                if (tmp == 0) {
                    var bs = String(b);
                    var i = s.length - p - 1 - bs.length; // i 应该大于0，小数点存在几个0
                    var dec = [];
                    for (var x = 0; x <= bit; x++) {
                        if (bs.charAt(x)) {
                            dec.push(bs.charAt(x))
                        } else {
                            dec.push(0)
                        }
                    }
                    if (bs.charAt(bit + 1)) {
                        dec.push('.');
                        dec.push(bs.charAt(bit + 1));
                    }
                    bs = dec.join('');
                    if (typeof (transToScientific) == "undefined" || transToScientific) {
                        b = Math.round(Number(bs)) / Math.pow(10, bit);
                        if (b == 0) {
                            b = '0'
                        } else {
                            b = b + 'e-' + (i + 1);
                        }
                    } else {
                        b = Math.round(Number(bs)) / Math.pow(10, (i + 1));
                    }
                } else {
                    b = Math.round(b / Math.pow(10, String(b).length - String(tmp).length));
                }
            }
            //整数部分大于0，小数部分大于0，取两位，不足补0
            if (f > 0 && b > 0) {
                var blank = [];
                var sb = String(b).split('').reverse().join('');
                for (var i = 0; i < bit; i++) {
                    if (sb.charAt(i)) {
                        blank.push(sb.charAt(i));
                    } else {
                        blank.push('0');
                    }
                }
                blank = blank.reverse();
                while (true) {
                    var v = blank.pop();
                    if (v != '0') {
                        blank.push(v);
                        break;
                    }
                }
                value = f + '.' + blank.join('');
            } else if (f > 0 && b == 0) {
                //整数部分大于0，小数取位后等于0，小数位补0
                var blank = ['.'];
                for (var i = 0; i < bit; i++) {
                    blank.push('0');
                }
                value = f + blank.join('');
            } else if (f == 0 && typeof b == 'number' && b > 0) {
                value = b / Math.pow(10, bit);
                //保留四位有效数字（若以"0.0000"开头则直接保留四位有效数字处理）
                if (value.toString().startsWith("0.0000")) {
                    return value.toFixed(4);
                }
            } else {
                value = b;
            }
        }
        //非科学计数法，若格式化后为整数，则处理
        if (TempoUtils.isFloat(value)) {
            if (parseFloat(value) == parseInt(value)) {
                value = parseInt(value) + "";
            }
        }
        return preFix + value;
    }
    /**
     * 处理d3作图数据太小导致显示不全问题
     * @param value
     */
    TempoMineUtils.dataD3Treating = function (value) {
        if (!value || !$.isNumeric(value)) {
            return value;
        }
        //将value转化为字符型
        var strValue = value + "";
        var test = /\d(?:.(\d*))?e([+-]\d+)/.test(Number(strValue));
        if(test){
            return Number(Number(strValue).toPrecision(4)).toExponential();
        }
        if(strValue.indexOf(".") == -1){
            return value;
        }
        if(strValue.indexOf("-") == -1){
            if(parseFloat(strValue) > 0.0001){
                return Number(Number(strValue).toFixed(4));
            }else {
                return Number(Number(strValue).toPrecision(4)).toExponential();
            }
        }else {
            if(parseFloat(strValue) < -0.0001){
                return Number(Number(strValue).toFixed(4));
            }else {
                return Number(Number(strValue).toPrecision(4)).toExponential();
            }
        }
    }
    /**
     * 处理科学计数法，使其保留4位展示
     *
     * @param value
     * @returns {string|*}
     */
    TempoMineUtils.scientificCounting=function (value) {
        if (!value || !$.isNumeric(value)) {
            return value;
        }
        //将value转化为字符型
        var strValue = value + "";
        if (strValue.startsWith("00") || (strValue.length >= 2 && (strValue.startsWith("0") && !strValue.startsWith("0.")))) {
            return value;
        }
        //科学计数法幂次超过6之后Number函数无法转成正确的数值类型，
        value = Number(value);
        var bit = 4
        //数值型转化为字符型并统一转化为小写
        var s = value.toString().toLowerCase();
        //取出数值中的幂次项
        //获取e的位置
        if(s.indexOf('e')>-1){
            var eIndex=s.lastIndexOf("e");
            //获取幂指数
            var powerValue=parseInt(s.substring(eIndex+1,s.length));
            //取出幂次项后重新赋值
            s=s.substring(0,eIndex);
        }
        //取出传入数值中的"-"号
        var preFix = "";
        if (s.startsWith("-")) {
            preFix = "-";
            //获取去除"-"后的值
            s = s.substring(1, s.length);
            value = s;
        }
        //获取小数点的位置
        var p = s.indexOf('.');
        //是不是带有小数位
        if (p > -1) {
            //获取整数部分大于等于0的数
            var f = Number(s.split('.')[0]);
            //获取小数部分大于等于0的数
            var b = Number(s.split('.')[1]);
            if (f > 0) {
                //获取小数部分前四位数
                b = Math.round(b / Math.pow(10, (s.length - p - 1) - bit));
                if (Math.pow(10, bit) == b) {
                    f += 1;
                    b = 0;
                }
            } else {
                //取小数部分的前bit位，是否为0
                var tmp = Math.floor(b / Math.pow(10, (s.length - p - 1) - bit));
                //如果为0
                if (tmp == 0) {
                    var bs = String(b);
                    // 得到小数点后0的个数
                    var i = s.length - p - 1 - bs.length;
                    //获取b值的前4位数，不足补零
                    var dec = [];
                    for (var x = 0; x <= bit; x++) {
                        if (bs.charAt(x)) {
                            dec.push(bs.charAt(x))
                        } else {
                            dec.push(0)
                        }
                    }
                    //如果bs值第五位有值，为dec添加"."和第五个数
                    if (bs.charAt(bit + 1)) {
                        dec.push('.');
                        dec.push(bs.charAt(bit + 1));
                    }
                    //对小数位重新赋值
                    bs = dec.join('');
                    //对bs取小数后四位
                    b = Math.round(Number(bs)) / Math.pow(10, bit);
                    if (b == 0) {
                        b = '0'
                    } else {
                        //如果存在科学计数法，则在原来的基础上减去小数位0的个数再减1
                        if(powerValue){
                            b = b + 'e' + (powerValue-i -1);
                        }else {
                            b = b + 'e-' + (i + 1);
                        }
                    }
                } else {
                    //小数点后不存在0，则四舍五入后取前四位
                    b = Math.round(b / Math.pow(10, String(b).length - String(tmp).length));
                }
            }
            //整数部分大于0，小数部分大于0，当小数部分获取到的数不足四位时，通过此处进行补零操作
            if (f > 0 && b > 0) {
                var blank = [];
                //通过reverse将小数位数字位置颠倒方便后边使用栈进行补零操作
                var sb = String(b).split('').reverse().join('');
                for (var i = 0; i < bit; i++) {
                    if (sb.charAt(i)) {
                        blank.push(sb.charAt(i));
                    } else {
                        blank.push('0');
                    }
                }
                //补零完成后通过，reverse方法是将值颠倒过来
                blank = blank.reverse();
                //判断小数位最后一位是否是零，如果是则将其删除
                while (true) {
                    var v = blank.pop();
                    if (v != '0') {
                        blank.push(v);
                        break;
                    }
                }
                //存在科学计数法，对处理后的值进行添加
                if(powerValue){
                    value = f + '.' + blank.join('')+'e'+powerValue;
                }else {
                    value = f + '.' + blank.join('');
                }
            } else if (f > 0 && b == 0) {
                //整数部分大于0，小数取位后等于0，小数位补0
                var blank = ['.'];
                for (var i = 0; i < bit; i++) {
                    blank.push('0');
                }
                value = f + blank.join('');
            } else if (f == 0 && typeof b == 'number' && b > 0) {
                //value的值为小数位除以10000的值
                value = b / Math.pow(10, bit);
                //保留四位有效数字（若以"0.0000"开头则直接保留四位有效数字处理）
                if (value.toString().startsWith("0.0000")) {
                    return value.toFixed(4);
                }
            } else {
                value = b;
            }
        }
        //非科学计数法，若格式化后为整数，则处理
        if (TempoUtils.isFloat(value)) {
            if (parseFloat(value) == parseInt(value)) {
                value = parseInt(value);
                if(powerValue){
                    value=Math.round(Number(value)) / Math.pow(10, bit);
                    value=value+"e"+(powerValue+4);
                }
            }
        }
        return preFix + value;
    }

    /**
     * ie10中不支持jquery的startsWith方法
     * 判断字符串str是否以value开始
     */
    TempoMineUtils.startsWith = function (str, value) {
        if (!str || !value) {
            return false;
        }
        if (str.indexOf(value) == 0) {
            return true;
        } else {
            return false;
        }
    }

    /**
     * ie10中不支持jquery的endsWith方法
     * 判断字符串str是否以value结尾
     */
    TempoMineUtils.endsWith = function (str, value) {
        if (!str || !value) {
            return false;
        }
        if (value.length > str.length) return false;
        if (str.lastIndexOf(value) == (str.length - value.length)) {
            return true;
        } else {
            return false;
        }
    }

    /**
     * 将传入的jqgrid列表中下拉类型的colModel项转换为datagrid的colModel的项
     * notUdfInput:标识下拉框是否可以手动输入，true标识不可手动输入
     */
    TempoMineUtils.getDatagridSelectColModel = function (item) {
        // 下拉框格式变换
        item.edittype = "selectmenu";
        // 宽度赋值
        if (item.width && !item.editoptions.width) {
            item.editoptions.width = item.width;
        }
        // 下拉框数据赋值
        var selectValue = item.editoptions.value;
        item.editoptions.data = function () {
            var keys = Object.keys(selectValue);
            return keys.map(function (key) {
                return {
                    id: key,
                    text: selectValue[key],
                    value: key
                }
            })
        }();
        // 下拉框formatter与unformat赋值
        item.formatter = function (key) {
            // 可编辑，且不是直接进入编辑状态，则返回key
            if (item.editable && item.inEditDirect != false && !item.notUdfInput) {
                return key || "";
            }
            return selectValue[key] || "";
        }
        item.unformat = function (val) {
            // 可编辑，且不是直接进入编辑状态，则返回key
            if (item.editable && item.inEditDirect != false && !item.notUdfInput) {
                return val || "";
            }

            for (var key in selectValue) {
                if (selectValue[key] === val) {
                    return key;
                }
            }
            return "";
        }
        // 下拉框没有change事件，则增加change事件，处理下拉框值更改后title信息没变的问题
        if (!item.editoptions.change) {
            item.editoptions.change = function (event, ui) {
                if (event.target.parentElement && event.target.parentElement.parentElement && event.currentTarget.textContent) {
                    $(event.target.parentElement.parentElement).attr("title", event.currentTarget.textContent);
                }
            }
        }
        return item;
    }

    /**
     * 格式化小数为百分比形式
     * @param num
     *            小数数字
     */
    TempoMineUtils.toPercent = function (num) {
        return (Math.round(num * 10000) / 100).toFixed(2) + '%';
    }

    /**
     * 判断页面是否可编辑，返回一个boolean值
     * @param formEditable
     */
    TempoMineUtils.canEdit = function (formEditable) {
        var canEdit = true;
        if (!formEditable) {
            canEdit = false;
        }
        return canEdit;
    }
    /**
     * 解析xml为dom
     */
    TempoMineUtils.xml2DOM = function (xmlString) {
        var xmlDoc = null;
        //IE
        if (!window.DOMParser && window.ActiveXObject) {
            var xmlDomVersion = ['MSXML.2.DOMDocument.6.0', 'MSXML.2.DOMDocument.6.0', 'Microsoft.XMLDOM'];
            for (var i = 0; i < xmlDomVersion.length; i++) {
                try {
                    xmlDoc = new ActiveXObject(xmlDomVersion[i]);
                    xmlDoc.async = false;
                    xmlDoc.loadXML(xmlString);
                } catch (e) {
                    console.log(e);
                }
            }
        }//Mozilla
        else if (window.DOMParser && document.implementation && document.implementation.createDocument) {
            try {
                var domParser = new DOMParser();
                xmlDoc = domParser.parseFromString(xmlString, 'text/xml');
            } catch (e) {
                console.log(e);
            }
        } else {
            return null;
        }
        return xmlDoc;
    };
    /**
     * 将传入的字符串中的参数全部替换
     * value:值
     * params:参数列表
     */
    TempoMineUtils.getActualValue = function (value, params) {
        // 若value值为空，或value中没有参数标识符$，或参数列表为空，则直接返回value
        if (!value || value.indexOf("$") == -1 || !params || params.length == 0) {
            return value;
        }
        var newParams = TempoUtils.clone(params);
        newParams = TempoMineUtils.convertDefaultParam(newParams);
        for (var i = 0; i < newParams.length; i++) {
            if (!newParams[i].paramName || newParams[i].paramValue == undefined) {
                continue;
            }
            var reg = new RegExp("\\$\\{" + newParams[i].paramName + "\\}", 'g');
            value = value.replace(reg, newParams[i].paramValue);
            // 替换完成后若不存在参数，则直接返回
            if (value.indexOf("$") == -1) {
                break;
            }
        }
        return value;
    }

    TempoMineUtils.getActualValueAddattributes = function (value, params) {
        // 若value值为空，或value中没有参数标识符$，或参数列表为空，则直接返回value
        if (!value || value.indexOf("$") == -1 || !params || params.length == 0) {
            return value;
        }
        var newParams = TempoUtils.clone(params);
        newParams = TempoMineUtils.convertDefaultParam(newParams);
        for (var i = 0; i < newParams.length; i++) {
            if (!newParams[i].paramName || newParams[i].paramValue == undefined) {
                continue;
            }
            var reg = new RegExp("\\$\\{" + newParams[i].paramName + "\\}", 'g');
            value = value.replace(reg, "'" + newParams[i].paramValue + "'");
            // 替换完成后若不存在参数，则直接返回
            if (value.indexOf("$") == -1) {
                break;
            }
        }
        return value;
    }


    /**
     * 转换流程变量参数中的预设参数
     */
    TempoMineUtils.convertDefaultParam = function (newParams) {
        // 当前服务器时间
        var curDate = new Date($.ajax({async: false}).getResponseHeader("Date"));
        if (!curDate) {
            curDate = new Date();
        }
        for (var i = 0; i < newParams.length; i++) {
            if (newParams[i].paramValue == "meirt_param_year") {
                // 当前年
                newParams[i].paramValue = curDate.getFullYear();
            } else if (newParams[i].paramValue == "meirt_param_month") {
                // 当前月
                newParams[i].paramValue = curDate.getMonth() + 1;
            } else if (newParams[i].paramValue == "meirt_param_week") {
                // 当前周
                newParams[i].paramValue = getWeekOfYear(curDate);
            } else if (newParams[i].paramValue == "meirt_param_day") {
                // 当前日
                newParams[i].paramValue = curDate.getDate();
            } else if (newParams[i].paramValue == "meirt_param_today") {
                // 当前日期
                newParams[i].paramValue = curDate.getFullYear() + "-" + (curDate.getMonth() + 1) + "-" + curDate.getDate();
            } else if (newParams[i].paramValue == "meirt_param_now") {
                // 当前时间
                newParams[i].paramValue = TempoUtils.getNowFormatDate(curDate);
            }
        }
        return newParams;
    }

    /**
     * 传入时间，获取传入的日期是所属年的第几周
     */
    var getWeekOfYear = function (curDate) {
        var curWeek = curDate.getDay();
        if (isNaN(curWeek) || curWeek > 6) {
            curWeek = 0;
        }
        var year = curDate.getFullYear();
        var firstDay = new Date(year, 0, 1);
        var firstWeekDays = 7 - firstDay.getDay() + curWeek;
        var dayOfYear = ((curDate - firstDay) / (24 * 3600 * 1000)) + 1;
        return Math.ceil((dayOfYear - firstWeekDays) / 7) + 1;
    }

    /**
     * 设置grid中下拉框的冒泡信息
     * thisGrid:列表
     * rowId:需要设置行title的行id
     * titles：冒泡信息,数组类型
     * gridId：列表id
     * selectNames：下拉框名称，数组类型
     */
    TempoMineUtils.setGridSelectTitle = function (thisGrid, rowId, titles, gridId, selectNames) {
        if (titles.length != selectNames.length) {
            return;
        }
        for (var i = 0; i < selectNames.length; i++) {
            thisGrid.find("#" + rowId + " td[aria-describedby='" + gridId + "_" + selectNames[i] + "']").attr("title", titles[i]);
        }
    }

    /**
     * 设置grid中下拉框的冒泡信息
     * meta:所有列名称
     * newName:新生成的列
     */
    TempoMineUtils.getNotRepeatName = function (meta, newName, addMeta) {
        // 取出元信息中的列字段名
        var nameCache = [];
        if (!meta || meta.length == 0) {
            return newName;
        }
        for (var i = 0; i < meta.length; i++) {
            var metaObj = TempoMineMetaUtils.convertMetaToObj(meta[i]);
            nameCache.push(metaObj.desc);
        }
        while (nameCache.indexOf(newName) > -1) {
            newName = newName + "1";
        }
        if (addMeta) {
            var rs = addMeta.filter(function (v) {
                if (v[0] == newName) {
                    return true
                }
            });
            if (rs.length > 0) {
                return false;
            }
        }
        return newName;
    }

    /**
     * 校验传入的名称是否以TEMPO_VERCTOR_PREFIX开始，若是，则标明当前列为向量列
     * 返回值：{flag,newName:"去掉前缀后的名称"}
     */
    TempoMineUtils.getVectorRes = function (meta, name) {
        var res = {"flag": false, "name": name};
        if (TempoMineUtils.startsWith(name, window.mineConstant.TEMPO_VERCTOR_PREFIX)) {
            res.flag = true;
            res.name = name.substring(window.mineConstant.TEMPO_VERCTOR_PREFIX.length);
            res.name = TempoMineUtils.getNotRepeatName(meta, res.name);
        }
        // 禅道68192：针对部分对大小写敏感的数据库，如greenplum
        else if(TempoMineUtils.startsWith(name, window.mineConstant.TEMPO_VERCTOR_PREFIX_LOWERCASE)){
            res.flag = true;
            res.name = name.substring(window.mineConstant.TEMPO_VERCTOR_PREFIX_LOWERCASE.length);
            res.name = TempoMineUtils.getNotRepeatName(meta, res.name);
        }
        return res;
    }
    /**
     * 挖掘中弹出一行编辑框
     */
    TempoMineUtils.popEditDialog = function (title, placeholder, initName, callBack) {
        var paramDialog = $('<div style="width:100%;height:100%;"/></div>').appendTo($('body'));
        paramDialog.dialog({
            title: title,
            autoOpen: true,
            width: 400,
            height: 170,
            resizable: false,
            modal: true,
            close: function () {
                paramDialog.find("#rename-category").empty();
                paramDialog.dialog('destroy');
                paramDialog.remove();
            },
            open: function () {
                var renameDiv = $('<div id="rename-category">').appendTo($(this));
                if (placeholder == null) {
                    placeholder = "";
                }
                $('<input id="rename-category-textarea" ui-role="validatebox" style="width:354px;" class="tempo-validatebox"/>').validatebox({
                    autofill: false,
                    validator: true,
                    tip: TempoUtils.locale("mine.lengthRuleCheck"),
                    required: true,
                    valids: [/^[a-zA-Z]{1}[a-zA-Z0-9]{0,29}$/]
                }).attr('placeholder', placeholder).appendTo(renameDiv);
                var textArea = renameDiv.find("#rename-category-textarea");
                if (initName != null) {
                    textArea.val(initName);
                }
            },
            buttons: [
                {
                    text: TempoUtils.locale("mine.publish-dialog-sure"),
                    click: function () {
                        if (!paramDialog.find("#rename-category-textarea").validatebox('validate')) {
                            return;
                        }
                        var reqParams = {name: paramDialog.find("#rename-category-textarea").val()};
                        callBack(reqParams, paramDialog);
                    }
                },
                {
                    text: TempoUtils.locale("mine.publish-dialog-cancel"),
                    click: function () {
                        paramDialog.dialog('destroy');
                        paramDialog.remove();
                    }
                }
            ]
        });
        return paramDialog;
    }

    ;(function () {
        //扩展String原型的方法，弥补IE下的不足
        if (String.prototype.startsWith === undefined) {
            String.prototype.startsWith = function (val) {
                if (val != undefined) {
                    val = val.toString();
                    return this.indexOf(val) == 0;
                } else {
                    return false;
                }
            }
        }
        if (String.prototype.endsWith === undefined) {
            String.prototype.endsWith = function (val) {
                if (val != undefined) {
                    val = val.toString();
                    return this.length >= val.length
                        && this.lastIndexOf(val) == (this.length - val.length);
                } else {
                    return false;
                }
            }
        }
    })();
    /**
     * 对字符串中的特殊正则字符进行处理转义
     */
    TempoMineUtils.flapRegex = function (name) {
        var regex = /[\(\)\[\]\^\$\|\.\*\+\?\!\\\{\}]/g;
        return typeof name == 'string' ? name.replace(regex, "\\$&") : name;
    }

    /**
     * 对数字进行截取显示---科学计数大数
     * @param value
     * @param offset
     */
    TempoMineUtils.trimNumber = function (value, offset) {
        if (!offset) offset = 8;
        var v = TempoMineUtils.format(value);
        if (v.toString().length > offset && !v.toString().match(/[eE]/)) {
            var arr = Number(v).toExponential(2).split(/[eE]/);
            if (arr.length != 2) {
                return v;
            }
            var rs = [];
            if (parseFloat(arr[0])) {
                rs.push(parseFloat(arr[0]))
            }
            if (rs.length == 1) {
                rs.push('e')
            }
            if (rs.length == 2) {
                rs.push(arr[1])
            }
            return rs.join('');
        }
        return v;
    }

    /**
     * 配色版初始化赋值或更换下拉框后赋值
     * colorDiv:配色版div
     * value：值为数组下标，默认为0
     */
    TempoMineUtils.initColorPanelValue = function (colorDiv, value) {
        colorDiv.css({
            "display": "inline",
            "vertical-align": "middle"
        });
        var exampleDiv = colorDiv.empty();
        if (!value) {
            value = "0";
        }
        var colorExample = TempoMineChartUtils.DEFAULT_COLORS[value];
        $.each(colorExample, function (i, color) {
            $("<div style='width:13px;height:13px;display:inline-block;'/>").css("background-color", color).appendTo(exampleDiv);
        });
    }

    /**
     * 校验输入节点的分区记录条数是否合法
     * [1000,1000000]之间的整数
     */
    TempoMineUtils.validInputRepartition = function (value) {
        if (!TempoUtils.isInt(value) || parseInt(value) < 1000 || parseInt(value) > 10000000) {
            $("<div/>").alert({
                msg: TempoUtils.locale("mine.input_repartition_num_error"),
                title: TempoUtils.locale("mine.prompt")
            });
            return false;
        }
        return true;
    }

    TempoMineUtils.createPortLabelTip = function (label) {
        var html = '';
        if (label) {
            html = "<div class='tempo-mine-portlabeltip tempo-mine-portlabeltip-overhide'><span class='ui-icon tempo-ui-icon-tip tempo-ui-icon-no-mutual tempo-ui-icon-white'></span><span>" + TempoUtils.locale("mine.port") + "：" + label + "</span></div>";
        }
        return html;
    }

    TempoMineUtils.readyForFeature = function (meta, data) {
        var resultObj = {
            dataInput: false,
            input: true,
            output: false,
            outputType: false
        };
        if (!meta || !meta.length || meta.length == 0) {
            return resultObj;
        }
        var predictionNum = 0;
        var labelNum = 0;
        var labelValidNum = 0;
        var metadataValidNum = 0;
        for (var i = 0; i < meta.length; i++) {
            if (!$.isArray(meta[i]) && meta[i].length < 4) {
                continue;
            } else {
                metadataValidNum++;
            }
            var metaData = TempoMineMetaUtils.convertMetaToObj(meta[i]);
            if (metaData.role == window.constant.MINE_DATA_ROLE.PREDICTION) {
                if (TempoMineMetaUtils.isDateTime(metaData.type) || TempoMineMetaUtils.isText(metaData.type)) {
                    resultObj.input = false;
                    resultObj.msg = TempoUtils
                        .locale("mine.node_input_classification_error");
                }
                predictionNum++;
            }
            if (metaData.role == window.constant.MINE_DATA_ROLE.LABEL) {
                if (TempoMineMetaUtils.isChar(metaData.type)
                    || TempoMineMetaUtils.isNumber(metaData.type)) {
                    labelValidNum++;
                }
                labelNum++;
            }
        }
        if (predictionNum == 0) {
            resultObj.input = false;
        }
        if (metadataValidNum > 0) {
            resultObj.dataInput = true;
        }
        if (labelNum == 0) {
            resultObj.output = false;
        } else if (labelValidNum == 0) {
            resultObj.outputType = false;
            resultObj.msg = TempoUtils.locale("mine.setonechnumlabel");
        } else if (labelNum == 1 && labelValidNum == 1) {
            resultObj.output = true;
            resultObj.outputType = true;
        } else if (labelNum > 1) {
            resultObj.outputType = false;
            resultObj.msg = TempoUtils.locale("mine.setonelabel");
        }
        resultObj.isOk = resultObj.dataInput === true
            && resultObj.input === true && resultObj.output === true
            && resultObj.outputType === true;
        return resultObj;
    }

    TempoMineUtils.metadataToJsonstr = function (metadata) {
        var metadataRet = [];
        var metadataClone = TempoUtils.clone(metadata);
        for (var i = 0; i < metadataClone.length; i++) {
            var metadataItem = metadataClone[i];
            if (window.mineConstant.ROLE_TYPE_PREDICTION == metadataItem.role
                || window.mineConstant.ROLE_TYPE_LABEL == metadataItem.role
                || window.mineConstant.ROLE_TYPE_BINING == metadataItem.role) {
                if (TempoMineMetaUtils.isNumber(metadataItem.type)) {
                    metadataClone[i].type = "NUMBER";
                }
                metadataRet.push(metadataClone[i]);
            }
        }
        var compareFun = function (item1, item2) {
            if (item1.desc < item2.desc)
                return -1;
            else if (item1.desc > item2.desc) {
                return 1;
            } else {
                return 0;
            }
        }
        var ret = metadataRet.sort(compareFun);
        return JSON.stringify(ret);
    }


    /**
     * 获取元信息中参与训练的模型字段排序后的字符串
     * @param metadata
     * @returns {string}
     */
    TempoMineUtils.metadataToJsonstrNew = function (metadata) {
        var metadataRet = [];
        var metadataClone = TempoUtils.clone(metadata);
        for (var i = 0; i < metadataClone.length; i++) {
            var metadataItem = metadataClone[i];
            if (window.mineConstant.ROLE_TYPE_PREDICTION == metadataItem.role
                || window.mineConstant.ROLE_TYPE_LABEL == metadataItem.role
                || window.mineConstant.ROLE_TYPE_BINING == metadataItem.role) {

                metadataRet.push(metadataClone[i]);
            }
        }
        var compareFun = function (item1, item2) {
            if (item1.desc < item2.desc)
                return -1;
            else if (item1.desc > item2.desc) {
                return 1;
            } else {
                return 0;
            }
        }
        var ret = metadataRet.sort(compareFun);
        return JSON.stringify(ret);
    }

    TempoMineUtils.compareMetadataIsSame = function (metadata1, metadata2) {
        if (!metadata1 && !metadata2) {
            return true;
        }
        if ((!metadata1 && metadata2) || (metadata1 && !metadata2)) {
            return false;
        }
        if (metadata1.length != metadata2.length) {
            return false;
        }
        var metadata2ItemStrArr = [];
        for (var i = 0; i < metadata2.length; i++) {
            var metadata2ItemStr = JSON.stringify(metadata2[i]);
            metadata2ItemStrArr.push(metadata2ItemStr);
        }
        for (var i = 0; i < metadata1.length; i++) {
            var metadata2ItemStr = JSON.stringify(metadata1[i]);
            if (metadata2ItemStrArr.indexOf(metadata2ItemStr) == -1) {
                return false;
            }
        }
        return true;
    }

    TempoMineUtils.getDownLoadBtn = function () {
        return $("<button class='downAll' style='background: #f8fafd;height:28px;border: 1px solid #D7DDE5;width:110px;margin-left: 40px;padding-right: 10px;padding-left: 10px;font-size: 13px;margin-bottom: 5px;'>" + TempoUtils.locale("mine.downall") + "</button>").button({
            icon: "ui-icon tempo-ui-icon tempo-ui-icon-no-mutual tempo-ui-icon-mine-download"
        });
    }

    /**
     * 当前分析表的状态
     */
    TempoMineUtils.analyseStatus = (function () {
        //当前面板类型
        var type = null;
        //当前面板id
        var mainId = null;
        //建模面板组
        var flowPanels = {};
        //模板数据
        var mainData = {};
        //洞察面板组
        var viewPanels = {};
        //报告面板
        var reportPanel = {};
        //页签
        var sheets = {};
        //全局数据
        var global = {};

        // 实现队列
        function Queue(size) {
            var pool = [];
            this.size = size;
            this.push = function (id) {
                pool.push(id);
                if (pool.length > this.size) {
                    return pool.shift();
                } else {
                    return undefined;
                }
            }
        }

        // 设置缓存的面板个数为10，采用先进先出策略
        var panelQueue = new Queue(10);
        //每个场景页的回退队列
        boardUndoManagers = {};

        return {
            getType: function () {
                return type;
            },
            setType: function (value) {
                type = value;
            },
            setMainId: function (value) {
                mainId = value;
            },
            getMainId: function () {
                return mainId;
            },
            addFlowPanel: function (id, panel) {
                flowPanels[id] = panel;
                return panelQueue.push(id);
            },
            addMainData: function (id, data) {
                mainData[id] = data;
            },
            getMainData: function (id) {
                return mainData[id];
            },
            getFlowPanel: function (id) {
                return flowPanels[id];
            },
            removeFlowPanel: function (id) {
                delete flowPanels[id];
            },
            addViewPanel: function (id, panel) {
                viewPanels[id] = panel;
            },
            getViewPanel: function (id) {
                return viewPanels[id];
            },
            removeViewPanel: function (id) {
                delete viewPanels[id];
            },
            addSheet: function (id, sheet) {
                sheets[id] = sheet;
            },
            getSheet: function (id) {
                return sheets[id];
            },
            removeSheet: function (id) {
                delete sheets[id];
            },
            put: function (key, value) {
                return global[key] = value;
            },
            get: function (key) {
                return global[key];
            },
            remove: function (key) {
                delete global[key];
            },
            getUndoManager: function () {
                var manager = boardUndoManagers[mainId];
                if (!manager) {
                    manager = boardUndoManagers[mainId] = new UndoManager();
                    manager.setCallback(function () {
                        Eventbus.trigger('enableUndoRedoButton.mine');
                    });
                }
                return manager;
            },
            removeUndoManager: function (id) {
                var manager = boardUndoManagers[id];
                if (manager) {
                    manager.clear();
                    manager = null;
                }
                delete boardUndoManagers[id];
            },
            empty: function () {
                //当前面板类型
                type = null;
                //当前面板id
                mainId = null;
                //建模面板组
                flowPanels = {};
                //洞察面板组
                viewPanels = {};
                //报告面板
                reportPanel = {};
                //页签
                sheets = {};
                //全局数据
                global = {};
                //
                panelQueue = new Queue(10);
                //
                boardUndoManagers = {};
            }
        }
    })();

    $.datepicker.setDefaults({
        showButtonPanel: true,
        afterShow: function (input) {
            var buttonPane = $(input).datepicker('widget')
                .find('.ui-datepicker-buttonpane');
            if (buttonPane.find(".ui-state-default.ui-priority-primary.ui-corner-all.mark").length == 0) {
                $('<button>', {
                    text: TempoUtils.locale("mine.qingchu"),
                    click: function () {
                        $.datepicker._clearDate(input);
                    }
                }).addClass('ui-state-default ui-priority-primary ui-corner-all mark')
                    .appendTo(buttonPane);
            }
        }
    });

    /**
     * 添加jQuery的工具方法
     */
    var proxy = function (param) {
        var url = param.url || '';
        url = url.startsWith(contextPath) ? url : contextPath + url;
        $.ajax({
            url: url,
            data: param.data,
            type: param.method,
            contentType: param.contentType,
            async: param.async == undefined ? true : !!param.async,
            traditional: true,
            success: function (data) {
                if ($.isFunction(param.success)) param.success(data);
            },
            complete: function (response) {
                if ($.isFunction(param.complete)) param.complete(response);
            },
            error: function (response, textStatus, errorThrown) {
                if ($.isFunction(param.error)) param.error(response);
                else {
                    console.error('Error: ' + textStatus);
                }
            }
        });
    }

    $.extend({
        postJson: function (postParam) {
            var param = {
                method: 'POST',
                contentType: 'application/json; charset=UTF-8'
            };
            if (typeof postParam.data == 'object') {
                var data = JSON.stringify(postParam.data);
                postParam.data = data;
            }
            if (typeof postParam.data != 'string') {
                throw Error('Unsupport data type: ' + typeof postParam.data);
            }
            proxy($.extend(postParam, param));
        },
        postForm: function (postParam) {
            var param = {
                method: 'POST',
                contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
                traditional: true
            };
            proxy($.extend(postParam, param));
        },
        getQuery: function (getParam) {
            var param = {
                method: 'GET',
                contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
                data: {}
            };
            if (!$.isEmptyObject(getParam.data)) {
                var url = getParam.url;
                var query = [];
                for (var name in getParam.data) {
                    query.push(encodeURIComponent(name) + '=' + encodeURIComponent(getParam.data[name]));
                }
                ;
                url = url.indexOf('?') > 0 ? url + '&' + query.join('&') : url + '?' + query.join('&');
                getParam.url = url;
            }
            proxy($.extend(getParam, param));
        }
    });


    TempoMineUtils.extractRoleMetadata = function (metaData, role) {
        var metadata = TempoUtils.clone(metaData);
        var metadataWithRole = [];
        if (metadata && metadata.length > 0) {
            for (var i = 0; i < metadata.length; i++) {
                var item = TempoMineMetaUtils.convertMetaToObj(metadata[i]);
                if (role == item.role) {
                    if (TempoMineMetaUtils.isNumber(item.type)) {
                        item.type = "NUMBER";
                    }
                    var metadataItem = [item.desc, item.type, item.role];
                    metadataWithRole.push(metadataItem.join(""));
                }
            }
        }
        return metadataWithRole;
    }
    /**
     *获取数据中的自变量
     *
     * @param metaData  输入数据
     * @returns {*[]}   返回 名称+类型+角色拼接结果
     */
    TempoMineUtils.extractCalculateMetadata = function (metaData) {
        var metadata = TempoUtils.clone(metaData);
        var metadataWithRole = [];
        if (metadata && metadata.length > 0) {
            for (var i = 0; i < metadata.length; i++) {
                var item = TempoMineMetaUtils.convertMetaToObj(metadata[i]);
                if (window.mineConstant.ROLE_TYPE_PREDICTION == item.role ||
                    window.mineConstant.ROLE_TYPE_LABEL == item.role) {
                    //如果是数值类型统一将类型设置为NUMBER方便判断
                    if (TempoMineMetaUtils.isNumber(item.type)) {
                        item.type = "NUMBER";
                    }
                    var metadataItem = [item.desc, item.type, item.role];
                    metadataWithRole.push(metadataItem.join(""));
                }
            }
        }
        return metadataWithRole;
    }

    /**
     * 提取元信息中的ID列
     *
     * @param metaData
     * @returns {*[]}
     */
    TempoMineUtils.extractIdColumnMetadata = function (metaData) {
        var metadata = TempoUtils.clone(metaData);
        var metadataWithRole = [];
        if (metadata && metadata.length > 0) {
            for (var i = 0; i < metadata.length; i++) {
                var item = TempoMineMetaUtils.convertMetaToObj(metadata[i]);
                //判断是否是ID列
                if (window.mineConstant.ROLE_TYPE_ID == item.role) {
                    //以名称+类型+角色的方式保存
                    var metadataItem = [item.desc, item.type, item.role];
                    metadataWithRole.push(metadataItem.join(""));
                }
            }
        }
        return metadataWithRole;
    }
    /**
     * 判断两个字段数据是否一致
     *
     * @param metaDataOne
     * @param metaDataTwo
     * @returns {boolean}
     */
    TempoMineUtils.compareMetadataIsSameEval = function (metaDataOne, metaDataTwo) {
        if (!metaDataOne && metaDataTwo) {
            return false;
        } else if (metaDataOne && !metaDataTwo) {
            return false;
        } else if (metaDataOne.length != metaDataTwo.length) {
            return false;
        } else {
            var metaDataOneSorted = metaDataOne.sort();
            var metaDataTwoSorted = metaDataTwo.sort();
            if (metaDataOneSorted.join("") == metaDataTwoSorted.join("")) {
                return true;
            } else {
                return false;
            }
        }
    }

    /**
     * 渲染编程节点代码提示关键字项
     */
    TempoMineUtils.renderCodeHintItem = function (words) {
        return words.map(function (word) {
            return {
                text: word,
                label: word,
                render: function (el, data, item) {
                    var icon = "<span class='tempo-mine-code-keyword-icon ui-icon' />";
                    var item = "<span class='tempo-mine-code-keyword-item' >" + word + "</span>";
                    $(el).append(icon + item);
                }
            };
        });
    }
    /**
     * 处理代码提示关键字
     */
    TempoMineUtils.codeShowHint = function (cm, pos) {
        var p = cm.getCursor();
        var line = cm.getLine(p.line)
        var token = cm.getTokenAt(p);
        var to = CodeMirror.Pos(p.line, token.end);
        var words = cm.getHelper(cm.getCursor(), "hintWords");
        var result = [].concat(CodeMirror.ukeys || [], words)
        words = [];
        var obj = {}
        for (var i = 0; i < result.length; i++) {
            if (!obj[result[i]]) {
                words.push(result[i])
                obj[result[i]] = 1
            }
        }
        if (token.string && /\w/.test(token.string[token.string.length - 1])) {
            var term = token.string, from = CodeMirror.Pos(p.line, token.start);
        } else {
            var term = "", from = to;
        }
        var found = [];
        for (var i = 0; i < words.length; i++) {
            var word = words[i];
            if (word && word.slice(0, term.length) == term)
                found.push(word);
        }

        return {
            list: TempoMineUtils.renderCodeHintItem(found),
            from: from,
            to: to
        };
    }
    /**
     * 编辑器按键事件触发代码提示
     */
    TempoMineUtils.codeMirrorKeyPress = function (editor, scriptId) {
        var innerKeywords = ['getInPortValue', 'setOutPortValue', 'setNodeInsight', 'viewDFInsight'];
        return function () {
            var p = editor.getCursor();
            var line = editor.getLine(p.line)
            var token = editor.getTokenAt(p);
            if (token.string && (token.string.indexOf("\"") == 0 || token.type == "comment")) return;
            var words = editor.getValue() + "";
            // 过滤掉注释中的单词，不出现在提示中
            words = words.split('\n').filter(function (e) {
                return !e.startsWith(line);
            }).join(" ")
            //利用正则取出用户输入的所有的英文的字母
            words = words.replace(/[a-z]+[\-|\']+[a-z]+/ig, '').match(/([a-z]+)/ig);
            //将获取到的用户的单词传入CodeMirror,并在hint中做匹配
            CodeMirror.ukeys = words || [];
            if (scriptId != 'sparksql' && scriptId != 'tensorflow') {
                CodeMirror.ukeys = CodeMirror.ukeys.concat(innerKeywords);
            }
            // 显示智能提示
            editor.showHint();
        }
    }

    /**
     *
     * @param headerId 表头的input框id
     * @param dataGridData 表格数据
     * @param dataGrid 表格组件
     */
    TempoMineUtils.headerInputCheckedDataManage = function (headerId, dataGridData, dataGrid) {
        var flag = true;
        for (var i = 0; i < dataGridData.length; i++) {
            if (!dataGridData[i].outputselect) {
                flag = false;
                break;
            }
        }
        if (flag) {
            dataGrid.parent().parent().parent().find("#" + headerId).prop("checked", "checked");
        }
    }

    /**
     * 数据管理增加 修改36221bug
     * @param headerId 表头的input框id
     * @param bodyId 表体的input框id
     * @param dataGrid 表格组件
     */
    TempoMineUtils.addInputClickDataManage = function (headerId, bodyId, dataGrid) {
        dataGrid.find("input[id*='" + headerId + "']").change(function () {
            var outputSelectFlag = true;
            var outputSelectDoms = dataGrid.find("input[id*='" + headerId + "']");
            for (var i = 0; i < outputSelectDoms.length; i++) {
                var checked = $(outputSelectDoms[i]).is(':checked');
                if (!checked) {
                    outputSelectFlag = false;
                    break;
                }
            }
            var headerInput = dataGrid.parent().parent().parent().find("#" + bodyId);
            if (outputSelectFlag) {
                headerInput.prop("checked", "checked");
            } else {
                headerInput.removeAttr("checked");
            }
        });
    }

    /**
     * 将获取的所有算法节点保存到页面window对象中
     */
    TempoMineUtils.saveAllAlgorithmNodeInfoToWindow = function (alg) {
        window[window.constant.MNODES] = {};
        //将获取的所有算法节点保存到页面window对象中
        window[window.constant.DATAMINE_COMMONOPER] = TempoPluginUtils.pluginExtend(alg[window.constant.DATAMINE_COMMONOPER]);
        window[window.constant.DATAMINE_TYP] = TempoPluginUtils.pluginExtend(alg[window.constant.DATAMINE_TYP]);
        window[window.constant.DATAMINE_PRE] = TempoPluginUtils.pluginExtend(alg[window.constant.DATAMINE_PRE]);
        window[window.constant.DATAMINE_DATA] = TempoPluginUtils.pluginExtend(alg[window.constant.DATAMINE_DATA]);
        window[window.constant.DATAMINE_CONTROL] = TempoPluginUtils.pluginExtend(alg[window.constant.DATAMINE_CONTROL]);
        window[window.constant.DATAMINE_CHART] = TempoPluginUtils.pluginExtend(alg[window.constant.DATAMINE_CHART]);
        window[window.constant.DATAMINE_ALG] = TempoPluginUtils.pluginExtend(alg[window.constant.DATAMINE_ALG]);
        window[window.constant.DATAMINE_EXTEND] = TempoPluginUtils.pluginExtend(alg[window.constant.DATAMINE_EXTEND]);
        window[window.constant.DATAMINE_MODEL] = TempoPluginUtils.pluginExtend(alg[window.constant.DATAMINE_MODEL]);
        window[window.constant.USER_DEFINED] = TempoPluginUtils.pluginExtend(alg[window.constant.USER_DEFINED]);
        window[window.constant.DATAMINE_FUNSION] = TempoPluginUtils.pluginExtend(alg[window.constant.DATAMINE_FUNSION]);
        window[window.constant.DATAMINE_FEATUREENG] = TempoPluginUtils.pluginExtend(alg[window.constant.DATAMINE_FEATUREENG]);
        window[window.constant.DATAMINE_STATISTICS] = TempoPluginUtils.pluginExtend(alg[window.constant.DATAMINE_STATISTICS]);
        window[window.constant.DATAMINE_DEEPLEARNING] = TempoPluginUtils.pluginExtend(alg[window.constant.DATAMINE_DEEPLEARNING]);
        window[window.constant.DATAMINE_INTEGRATED] = TempoPluginUtils.pluginExtend(alg[window.constant.DATAMINE_INTEGRATED]);
        window[window.constant.DATAMINE_AUTO] = TempoPluginUtils.pluginExtend(alg[window.constant.DATAMINE_AUTO]);
        window[window.constant.DATAMINE_CF] = TempoPluginUtils.pluginExtend(alg[window.constant.DATAMINE_CF]);
        window[window.constant.DATAMINE_TEXTMINING] = TempoPluginUtils.pluginExtend(alg[window.constant.DATAMINE_TEXTMINING]);
        //流处理
        window[window.constant.DATAMINE_STREAM] = TempoPluginUtils.pluginExtend(alg[window.constant.DATAMINE_STREAM]);
        //金融分析
        window[window.constant.DATAMINE_FINANCE] = TempoPluginUtils.pluginExtend(alg[window.constant.DATAMINE_FINANCE]);
        //信号处理
        window[window.constant.DATAMINE_SIGNAL] = TempoPluginUtils.pluginExtend(alg[window.constant.DATAMINE_SIGNAL]);
    }

    /**
     * 将获取的所有算法节点图标保存到页面window对象中
     */
    TempoMineUtils.saveAllAlgorithmNodeIconToWindow = function (groupCategory) {
        groupCategory(window[window.constant.DATAMINE_COMMONOPER]);
        groupCategory(window[window.constant.DATAMINE_TYP]);
        groupCategory(window[window.constant.DATAMINE_PRE]);
        groupCategory(window[window.constant.DATAMINE_DATA]);
        groupCategory(window[window.constant.DATAMINE_CONTROL]);
        groupCategory(window[window.constant.DATAMINE_CHART]);
        groupCategory(window[window.constant.DATAMINE_ALG]);
        groupCategory(window[window.constant.DATAMINE_EXTEND]);
        groupCategory(window[window.constant.DATAMINE_MODEL]);
        groupCategory(window[window.constant.USER_DEFINED]);
        groupCategory(window[window.constant.DATAMINE_FUNSION]);
        groupCategory(window[window.constant.DATAMINE_FEATUREENG]);
        groupCategory(window[window.constant.DATAMINE_STATISTICS]);
        groupCategory(window[window.constant.DATAMINE_DEEPLEARNING]);
        groupCategory(window[window.constant.DATAMINE_INTEGRATED]);
        groupCategory(window[window.constant.DATAMINE_AUTO]);
        groupCategory(window[window.constant.DATAMINE_CF]);
        groupCategory(window[window.constant.DATAMINE_TEXTMINING]);
        groupCategory(window[window.constant.DATAMINE_STREAM]);
        groupCategory(window[window.constant.DATAMINE_FINANCE]);
        groupCategory(window[window.constant.DATAMINE_SIGNAL]);
    },
        /**
         * 排序组件，从tempo-moudle-core里复制过来的
         * @param closeTypeSort 是否需要关闭类型排序 true为关闭
         */
        TempoMineUtils.tableSortEvent = function (e, dataSourceCode, isModel, sortParam, selectCallBack, closeTypeSort) {
            var menuData = [{
                text: TempoUtils.locale("core.columnSortDefault"),
                id: '_abc_default'
            }, {
                text: TempoUtils.locale("core.columnSortNameAsc"),
                sortBy: "abc",
                sortType: "asc",
                id: '_abc_asc'
            }, {
                text: TempoUtils.locale("core.columnSortNameDesc"),
                sortBy: "abc",
                sortType: "desc",
                id: '_abc_desc'
            },];
            // 判断是否需要关闭类型排序 true为关闭
            if (!closeTypeSort) {
                menuData.push({
                    text: TempoUtils.locale("core.columnSortTypeAsc"),
                    sortByDir: true,
                    sortByDirType: "asc",
                    id: '_dir_asc'
                });
                menuData.push({
                    text: TempoUtils.locale("core.columnSortTypeDesc"),
                    sortByDir: true,
                    sortByDirType: "desc",
                    id: '_dir_desc'
                });
            }

            var modelMenu = $("<ul/>").appendTo($("body")).css({
                "z-index": 19999
            });
            modelMenu.contextmenu({
                data: menuData,
                show: false,
                select: function (e, ui) {
                    var sortBy = ui.select.sortBy;
                    var sortType = ui.select.sortType;
                    var sortByDir = ui.select.sortByDir;
                    var sortByDirType = ui.select.sortByDirType;
                    if (isModel && isModel == 1) {
                        if (ui.select.id == '_abc_asc' || ui.select.id == '_abc_desc') {
                            sortByDir = sortParam.sortByDir;
                            sortByDirType = sortParam.sortByDirType;
                        } else if (ui.select.id == '_dir_asc' || ui.select.id == '_dir_desc') {
                            sortBy = sortParam.sortBy;
                            sortType = sortParam.sortType;
                        } else {
                            sortBy = null;
                            sortByDir = null;
                        }
                    }
                    var metaDataModel = {
                        dataSourceCode: dataSourceCode,
                        startIndex: 0,
                        searchWord: null,
                        sortBy: sortBy,
                        sortType: sortType,
                        sortByDir: sortByDir,
                        sortByDirType: sortByDirType,
                        showWithTitle: true,
                        isModel: isModel
                    };
                    selectCallBack.call(selectCallBack, metaDataModel);
                }
            });

            modelMenu.contextmenu("show", {
                position: {
                    left: e.pageX,
                    top: e.pageY
                },
                linkEl: this
            });


            //获取查询参数进行回填
            if (sortParam) {
                var targetKey = null;
                var isDefualt = true;
                if (sortParam.sortBy) {//按字母排序
                    isDefualt = false;
                    targetKey = '_abc_' + sortParam.sortType;
                    modelMenu.contextmenu("setItemOption", "icon", "ui-icon tempo-ui-icon tempo-ui-icon-righticon", targetKey);
                }
                if (sortParam.sortByDir) {//按类型排序，有复选的情况，即：名称+类型排序
                    isDefualt = false;
                    targetKey = '_dir_' + sortParam.sortByDirType;
                    modelMenu.contextmenu("setItemOption", "icon", "ui-icon tempo-ui-icon tempo-ui-icon-righticon", targetKey);
                }
                if (isDefualt) {
                    targetKey = '_abc_default';
                    modelMenu.contextmenu("setItemOption", "icon", "ui-icon tempo-ui-icon tempo-ui-icon-righticon", targetKey);
                }

            }
            //如果不是模型库，则需要屏蔽类型排序方式
            if (isModel && isModel == 1) {
                modelMenu.contextmenu("showItem", '_dir_asc');
                modelMenu.contextmenu("showItem", '_dir_desc');
                modelMenu.contextmenu("showItem", '_abc_default');
            } else {
                modelMenu.contextmenu("hideItem", '_dir_asc');
                modelMenu.contextmenu("hideItem", '_dir_desc');
                modelMenu.contextmenu("hideItem", '_abc_default');
            }
        }

    /**
     * 对参数进行编码，针对对象
     * 推荐编码字符串
     * 如果是对象，需要后台解码
     */
    TempoMineUtils.encodeParams = function (params) {
        if (params != null && typeof params == "string") {
            // return encodeURIComponent(params);
            var byteArrays = pako.gzip(params)
            return "GZIP:" + base64js.fromByteArray(byteArrays)
        } else if (params != null && !$.isEmptyObject(params)) {
            for (var i in params) {
                if (typeof params[i] == "string") {
                    params[i] = encodeURIComponent(params[i]);
                }
            }
            params['encodeuri'] = true;
        } else {
            return params;
        }
    }

    //根据国际化类型加载相应国际化文件
    TempoMineUtils.loadCacheNode = function (target, loadCallBack) {
        var localStore = window.localStorage;
        var curMd5 = "md520181228";
        if (!target) {
            target = "mine_load_data_zh_CN";
        }
        var callback = function () {
        };
        if ($.isFunction(loadCallBack)) {
            callback = loadCallBack;
        }
        if (localStore && localStore[target]) {
            var json = JSON.parse(localStore[target]);
            if (json["md5"]) {
                curMd5 = json["md5"];
            }
        }
        $.ajax({
            url: contextPath + "/api/ai/mine/load",
            dataType: 'json',
            type: 'post',
            data: {curMd5: curMd5},
            success: function (data) {
                if (!localStore) {
                    callback(data);
                } else {
                    if (data.isCache != null && data.isCache == true) {
                        json.isYarn = !!data.isYarn;
                        json.isK8sCluster = !!data.isK8sCluster;
                        json.isK8sLocal = !!data.isK8sLocal;
                        json.isOpenHadoop = !!data.isOpenHadoop;
                        callback(json);
                    } else {
                        localStore[target] = JSON.stringify(data);
                        callback(data);
                    }
                }
            }
        });
    }

    /**
     * 初始化提示信息
     * @param disInfoSpan 提示图标元素
     * @param helpInfoId 提示信息对应的id
     * @param helpInfo 需要提示的信息
     * @param helpInfoWidth 提示信息的宽度 eg:200px
     * @param helpInfoHeight 提示信息的高度 eg:20px
     * @param helpInfoLeft 提示信息距离提示图标的右边距(数值型) eg:20
     * @param helpInfoTop 提示信息距离提示图标的上边距(数值型) eg:20
     * @param textAlign 文本对齐方式，不传递默认为center
     */
    TempoMineUtils.initPromptInfo = function (disInfoSpan, helpInfoId, helpInfo, helpInfoWidth, helpInfoHeight, helpInfoLeft, helpInfoTop, textAlign) {
        textAlign = textAlign ? textAlign : "center";
        var helpInfo = "<div id='" + helpInfoId + "' style='background: rgb(243, 245, 247);" +
            "position:absolute;position:absolute;width:" + helpInfoWidth + ";height:" + helpInfoHeight + ";backgroud:#e0e5e5;" +
            "box-shadow:0px 0px 3px rgb(46, 49, 53);z-index:99999;text-align: " + textAlign + ";'>" + helpInfo + "</div>";
        //判断只初始化一次
        if ($("#" + helpInfoId).length == 0) {
            $('body').append(helpInfo);
        }
        $("#" + helpInfoId).hide();
        disInfoSpan.mouseover(function () {
            var x = disInfoSpan.offset().left;
            var y = disInfoSpan.offset().top;
            $("#" + helpInfoId).css("left", x + helpInfoLeft);
            $("#" + helpInfoId).css("top", y + helpInfoTop);

            $("#" + helpInfoId).show();
        })
        disInfoSpan.mouseout(function () {
            $("#" + helpInfoId).hide();
        })
    }

    /**
     * 对可能出现的xss进行编码
     * '<' -->  &lt;
     * '>' -->  &gt;
     * @param value
     * @returns {string|*}
     */
    TempoMineUtils.xssEncode = function (value) {
        if (value && typeof (value) == "string") {
            return value.replace(/</g, "&lt;").replace(/>/g, "&gt;");
        } else {
            return value;
        }
    };

    /**
     * 构建自定义算法设计内容JSON串模板
     */
    TempoMineUtils.buildCustomAlgModel = function () {
        return {
            //算子名称，取自节点别名
            name: "",
            //算法节点ID，此处不传，后端接口会生成uuid
            nodeId: "",
            //算法语言，根据节点类型获取type
            lang: "",
            //自定义代码中的入口函数，此处取节点的eid，以此来作为算子文件的文件名称
            entryFunction: "",
            //算法描述，默认为空
            description: "",
            //算法图标，默认为空
            icon: "",
            //算子一级分类，为user_defined
            type: "user_defined",
            //算子二级分类，默认为空，此处由管理员审批后方可赋值
            category: '',
            //算子二级分类名称，默认为空，此处由管理员审批后方可赋值
            categoryName: '',
            //算法文件名称，由节点eid加后缀组成
            fileName: "",
            //配置参数
            parameters: [],
            testStatus: '',
            scopes: {
                inScope: [
                    {
                        //端口名称
                        name: '数据集',
                        //端口标识
                        code: 'in',
                        //测试数据文件名称
                        dataName: '',
                        //测试数据对应文件的文件ID
                        dataId: '',
                        //端口数据
                        data: {
                            //端口数据集
                            dataResult: {
                                cols: [],
                                datas: [],
                                status: "",
                            },
                            //解析文件参数
                            parserData: {
                                //编码格式
                                encodeTypeParam: "UTF-8",
                                //分隔字符
                                splitCharParam: "comma",
                                //sheet页
                                workSheetNameParam: "Sheet1"
                            }
                        },
                    }
                ],
                outScope: [
                    {
                        //端口名称
                        name: "数据集",
                        //端口标识
                        code: 'out',
                        //端口原信息
                        metadata: {
                            //类型
                            type: "default",
                            //输出端口集合
                            outPorts: [],
                            //新增字段
                            fields: [],
                            //自定义代码
                            code: ""
                        }
                    }
                ]
            },
            newAlg: true
        };
    };

    /**
     * 对查询结果进行截断处理，防止节点缓存过多的字符数据，导致查询变慢和任务提交失败问题（类似外网禅道1284bug）
     * @param datas
     * @returns {[]|*|{}}
     */
    TempoMineUtils.getInterceptDatas = function (datas) {
        var newDatas = TempoUtils.clone(datas);
        if (newDatas) {
            for (var i = 0; i < newDatas.length; i++) {
                var data = newDatas[i];
                for (var key in data) {
                    if (typeof (data[key]) === "string" && data[key].length > 1200) {
                        data[key] = data[key].substr(0, 1199);
                    }
                }
            }
        }
        return newDatas;
    };

    /**
     * 解压
     * @param data 解压数据
     * @returns {string}
     */
    TempoMineUtils.unzip = function (data) {
        //解压参数不能为空并且参数类型必须是字符类型
        if (data != null && typeof data == "string") {
            var strData = atob(data);
            var charData = [];
            var keyArray = strData.split('');
            for (var i = 0; i < keyArray.length; i++) {
                var item = keyArray[i];
                charData.push(item.charCodeAt(0));
            }
            var binData = new Uint8Array(charData);
            var data = pako.inflate(binData);
            var array = new Uint16Array(data);
            var res = '';
            var chunk = 8 * 1024;
            //采用分片解压防止数据量过大内存溢出
            for (var x = 0; x < array.length / chunk; x++) {
                res += String.fromCharCode.apply(null, array.slice(x * chunk, (x + 1) * chunk));
            }
            res += String.fromCharCode.apply(null, array.slice(x * chunk));
            strData = res;
            //解码防止中文乱码
            return decodeURIComponent(escape(strData));
        }
        return data;
    }
    /**
     * 自动择参输入输出数据判断比较
     *
     * @param inputData
     * @param OutputData
     * @returns {boolean}
     */
    TempoMineUtils.checkParameterSelectData=function (inputData,OutputData) {
        debugger;
        if(!inputData||!OutputData){
            return false;
        }
        //将输出端口数据设置为key=名称+别名+类型的格式
        var OutputMetaMap = TempoMineUtils.hashMap();
        for (var i = 0; i < OutputData.length; i++) {
            var meta = OutputData[i];
            var metaObj = TempoMineMetaUtils.convertMetaToObj(meta);
            //输出端口不是预测数据和time才可以存入map中
            if(metaObj.desc.indexOf("_prediction")==-1||metaObj.desc!="time"){
                OutputMetaMap.put(metaObj.desc + metaObj.name + metaObj.type+metaObj.role, metaObj);
            }
        }
        for (var i = 0; i <inputData.length; i++) {
            var inputDatum = inputData[i];
            var inputMetaData = TempoMineMetaUtils.convertMetaToObj(inputDatum);
            var keyN = inputMetaData.desc + inputMetaData.name + inputMetaData.type+inputMetaData.role;
            //从OutputMetaMap根据key获取数据
            var checkInputData= OutputMetaMap.get(keyN);
            if(!checkInputData){
                return false;
            }
        }
        return true;
    }
})(jQuery);